package
1.0.5
Repository: https://github.com/classzz/czzwallet.git
Documentation: pkg.go.dev

# README

votingpool

[Build Status] (https://travis-ci.org/gcash/bchwallet)

Package votingpool provides voting pool functionality for bchwallet as described here: Voting Pools.

A suite of tests is provided to ensure proper functionality. See test_coverage.txt for the gocov coverage report. Alternatively, if you are running a POSIX OS, you can run the cov_report.sh script for a real-time report. Package votingpool is licensed under the liberal ISC license.

Note that this is still a work in progress.

Feature Overview

  • Create/Load pools
  • Create series
  • Replace series
  • Create deposit addresses
  • Comprehensive test coverage

Documentation

[GoDoc] (http://godoc.org/github.com/gcash/bchwallet/votingpool)

Full go doc style documentation for the project can be viewed online without installing this package by using the GoDoc site here: http://godoc.org/github.com/gcash/bchwallet/votingpool

You can also view the documentation locally once the package is installed with the godoc tool by running godoc -http=":6060" and pointing your browser to http://localhost:6060/pkg/github.com/gcash/bchwallet/votingpool

Package votingpool is licensed under the copyfree ISC License.

# Functions

CanonicalKeyOrder will return a copy of the input canonically ordered which is defined to be lexicographical.
Create creates a new entry in the database with the given ID and returns the Pool representing it.
DisableLog disables all library log output.
Load fetches the entry in the database with the given ID and returns the Pool representing it.
LoadAndCreateSeries loads the Pool with the given ID, creating a new one if it doesn't yet exist, and then creates and returns a Series with the given seriesID, rawPubKeys and reqSigs.
LoadAndEmpowerSeries loads the voting pool with the given ID and calls EmpowerSeries, passing the given series ID and private key to it.
LoadAndGetDepositScript generates and returns a deposit script for the given seriesID, branch and index of the Pool identified by poolID.
LoadAndReplaceSeries loads the voting pool with the given ID and calls ReplaceSeries, passing the given series ID, public keys and reqSigs to it.
SignTx signs every input of the given MsgTx by looking up (on the addr manager) the redeem script for each of them and constructing the signature script using that and the given raw signatures.
UseLogger uses a specified Logger to output package logging info.

# Constants

CurrentVersion is the version used for newly created Series.
ErrCrypto indicates an error with the cryptography related operations such as decrypting or encrypting data, parsing an EC public key, or deriving a secret key from a password.
ErrDatabase indicates an error with the underlying database.
ErrInputSelection indicates an error in the input selection algorithm.
ErrInvalidBranch indicates that the given branch number is not valid for a given set of public keys.
ErrInvalidScriptHash indicates an invalid P2SH.
ErrInvalidValue indicates that the value of a given function argument is invalid.
ErrKeyChain indicates an error with the key chain typically either due to the inability to create an extended key or deriving a child extended key.
ErrKeyDuplicate indicates that a key is duplicated.
ErrKeyIsPrivate indicates that a private key was used where a public one was expected.
ErrKeyIsPublic indicates that a public key was used where a private one was expected.
ErrKeyMismatch indicates that the key is not the expected one.
ErrKeyNeuter indicates a problem when trying to neuter a private key.
ErrKeysPrivatePublicMismatch indicates that the number of private and public keys is not the same.
ErrPoolAlreadyExists indicates that an attempt has been made to create a voting pool that already exists.
ErrPoolNotExists indicates that an attempt has been made to access a voting pool that does not exist.
ErrPreconditionNotMet indicates a programming error since a preconditon has not been met.
ErrRawSigning indicates an error in the process of generating raw signatures for a transaction input.
ErrScriptCreation indicates that the creation of a deposit script failed.
ErrSeriesAlreadyEmpowered indicates that an already empowered series was used where a not empowered one was expected.
ErrSeriesAlreadyExists indicates that an attempt has been made to create a series that already exists.
ErrSeriesIDInvalid indicates an attempt to create a series with an invalid ID.
ErrSeriesIDNotSequential indicates an attempt to create a series with an ID that is not sequantial.
ErrSeriesNotActive indicates that an active series was needed but the selected one is not.
ErrSeriesNotExists indicates that an attempt has been made to access a series that does not exist.
ErrSeriesSerialization indicates that an error occurred while serializing or deserializing one or more series for storing into the database.
ErrSeriesVersion indicates that we've been asked to deal with a series whose version is unsupported.
ErrTooFewPublicKeys indicates that a required minimum of public keys was not met.
ErrTooManyReqSignatures indicates that too many required signatures are requested.
ErrTxSigning indicates an error when signing a transaction.
ErrUnknownPubKey indicates a pubkey that does not belong to a given series.
ErrWithdrawalProcessing indicates an internal error when processing a withdrawal request.
ErrWithdrawalStorage indicates an error occurred when serializing or deserializing withdrawal information.
ErrWithdrawalTxStorage indicates an error when storing withdrawal transactions.
ErrWithdrawFromUnusedAddr indicates an attempt to withdraw funds from an address which has not been used before.

# Structs

ChangeAddress is a votingpool address meant to be used on transaction change outputs.
Credit is an abstraction over wtxmgr.Credit used in the construction of voting pool withdrawal transactions.
Error is a typed error for all errors arising during the operation of the voting pool.
OutBailmentOutpoint represents one of the outpoints created to fulfill an OutputRequest.
OutputRequest represents one of the outputs (address/amount) requested by a withdrawal, and includes information about the user's outbailment request.
Pool represents an arrangement of notary servers to securely store and account for customer cryptocurrency deposits and to redeem valid withdrawals.
SeriesData represents a Series for a given Pool.
WithdrawalAddress is a votingpool address that may contain unspent outputs available for use in a withdrawal.
WithdrawalOutput represents a possibly fulfilled OutputRequest.
WithdrawalStatus contains the details of a processed withdrawal, including the status of each requested output, the total amount of network fees and the next input and change addresses to use in a subsequent withdrawal request.

# Interfaces

PoolAddress represents a voting pool P2SH address, generated by deriving public HD keys from the series' master keys using the given branch/index and constructing a M-of-N multi-sig script.

# Type aliases

Branch is the type used to represent a branch number in a series.
ErrorCode identifies a kind of error.
Index is the type used to represent an index number in a series.
InputAmounts is a slice of input amounts that is used to sign each input in a transaction.
Ntxid is the normalized ID of a given bitcoin transaction, which is generated by hashing the serialized tx with blank sig scripts on all inputs.
OutBailmentID is the unique ID of a user's outbailment, comprising the name of the server the user connected to, and the transaction number, internal to that server.
RawSig represents one of the signatures included in the unlocking script of inputs spending from P2SH UTXOs.
TxSigs is list of raw signatures (one for every pubkey in the multi-sig script) for a given transaction input.