Documentation ¶
Index ¶
- Constants
- Variables
- func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool, ...) int
- func SumOutputSerializeSizes(outputs []*wire.TxOut) (serializeSize int)
- type BitfinexDecoder
- type BittrexDecoder
- type ExchangeRateDecoder
- type ExchangeRateProvider
- type InputType
- type KrakenDecoder
- type OpenBazaarDecoder
- type PoloniexDecoder
- type ZCashWallet
- func (w *ZCashWallet) AddTransactionListener(callback func(wi.TransactionCallback))
- func (w *ZCashWallet) AddWatchedAddresses(addrs ...btcutil.Address) error
- func (w *ZCashWallet) AddWatchedScript(script []byte) error
- func (w *ZCashWallet) AddressToScript(addr btcutil.Address) ([]byte, error)
- func (w *ZCashWallet) AssociateTransactionWithOrder(cb wi.TransactionCallback)
- func (w *ZCashWallet) Balance() (wi.CurrencyValue, wi.CurrencyValue)
- func (w *ZCashWallet) Broadcast(tx *wire.MsgTx) (string, error)
- func (w *ZCashWallet) BumpFee(txid chainhash.Hash) (*chainhash.Hash, error)
- func (w *ZCashWallet) ChainTip() (uint32, chainhash.Hash)
- func (w *ZCashWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey bool) (*hd.ExtendedKey, error)
- func (w *ZCashWallet) Close()
- func (w *ZCashWallet) CreateMultisigSignature(ins []wi.TransactionInput, outs []wi.TransactionOutput, key *hd.ExtendedKey, ...) ([]wi.Signature, error)
- func (w *ZCashWallet) CurrencyCode() string
- func (w *ZCashWallet) CurrentAddress(purpose wi.KeyPurpose) btcutil.Address
- func (w *ZCashWallet) DecodeAddress(addr string) (btcutil.Address, error)
- func (w *ZCashWallet) DumpTables(wr io.Writer)
- func (w *ZCashWallet) EstimateFee(ins []wi.TransactionInput, outs []wi.TransactionOutput, feePerByte big.Int) big.Int
- func (w *ZCashWallet) EstimateSpendFee(amount big.Int, feeLevel wi.FeeLevel) (big.Int, error)
- func (w *ZCashWallet) ExchangeRates() wi.ExchangeRates
- func (w *ZCashWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, ...) (addr btcutil.Address, redeemScript []byte, err error)
- func (w *ZCashWallet) GetConfirmations(txid chainhash.Hash) (uint32, uint32, error)
- func (w *ZCashWallet) GetFeePerByte(feeLevel wi.FeeLevel) big.Int
- func (w *ZCashWallet) GetTransaction(txid chainhash.Hash) (wi.Txn, error)
- func (w *ZCashWallet) HasKey(addr btcutil.Address) bool
- func (w *ZCashWallet) IsDust(amount big.Int) bool
- func (w *ZCashWallet) MasterPrivateKey() *hd.ExtendedKey
- func (w *ZCashWallet) MasterPublicKey() *hd.ExtendedKey
- func (w *ZCashWallet) Multisign(ins []wi.TransactionInput, outs []wi.TransactionOutput, sigs1 []wi.Signature, ...) ([]byte, error)
- func (w *ZCashWallet) NewAddress(purpose wi.KeyPurpose) btcutil.Address
- func (w *ZCashWallet) Params() *chaincfg.Params
- func (w *ZCashWallet) ReSyncBlockchain(fromTime time.Time)
- func (w *ZCashWallet) ScriptToAddress(script []byte) (btcutil.Address, error)
- func (w *ZCashWallet) Spend(amount big.Int, addr btcutil.Address, feeLevel wi.FeeLevel, referenceID string, ...) (*chainhash.Hash, error)
- func (w *ZCashWallet) Start()
- func (w *ZCashWallet) SweepAddress(ins []wi.TransactionInput, address *btcutil.Address, key *hd.ExtendedKey, ...) (*chainhash.Hash, error)
- func (w *ZCashWallet) Transactions() ([]wi.Txn, error)
- type ZcashPriceFetcher
Constants ¶
View Source
const ( // RedeemP2PKHSigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a compressed P2PKH output. // It is calculated as: // // - OP_DATA_73 // - 72 bytes DER signature + 1 byte sighash // - OP_DATA_33 // - 33 bytes serialized compressed pubkey RedeemP2PKHSigScriptSize = 1 + 73 + 1 + 33 // RedeemP2SHMultisigSigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a 2 of 3 P2SH multisig output with compressed keys. // It is calculated as: // // - OP_0 // - OP_DATA_72 // - 72 bytes DER signature // - OP_DATA_72 // - 72 bytes DER signature // - OP_PUSHDATA // - OP_2 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP3 // - OP_CHECKMULTISIG RedeemP2SH2of3MultisigSigScriptSize = 1 + 1 + 72 + 1 + 72 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 33 + 1 + 1 // RedeemP2SH1of2MultisigSigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a 1 of 2 P2SH multisig output with compressed keys. // It is calculated as: // // - OP_0 // - OP_DATA_72 // - 72 bytes DER signature // - OP_PUSHDATA // - OP_1 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP2 // - OP_CHECKMULTISIG RedeemP2SH1of2MultisigSigScriptSize = 1 + 1 + 72 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 1 // RedeemP2SHMultisigTimelock1SigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a compressed P2SH timelocked multisig using the timeout. // It is calculated as: // // - OP_DATA_72 // - 72 bytes DER signature // - OP_0 // - OP_PUSHDATA // - OP_IF // - OP_2 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP3 // - OP_CHECKMULTISIG // - OP_ELSE // - OP_PUSHDATA // - 2 byte block height // - OP_CHECKSEQUENCEVERIFY // - OP_DROP // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_CHECKSIG // - OP_ENDIF RedeemP2SHMultisigTimelock1SigScriptSize = 1 + 72 + 1 + 1 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 33 + 1 + 1 + 1 + 1 + 2 + 1 + 1 + 1 + 33 + 1 + 1 // RedeemP2SHMultisigTimelock2SigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a compressed P2SH timelocked multisig without using the timeout. // It is calculated as: // // - OP_0 // - OP_DATA_72 // - 72 bytes DER signature // - OP_DATA_72 // - 72 bytes DER signature // - OP_1 // - OP_PUSHDATA // - OP_IF // - OP_2 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP3 // - OP_CHECKMULTISIG // - OP_ELSE // - OP_PUSHDATA // - 2 byte block height // - OP_CHECKSEQUENCEVERIFY // - OP_DROP // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_CHECKSIG // - OP_ENDIF RedeemP2SHMultisigTimelock2SigScriptSize = 1 + 1 + 72 + +1 + 72 + 1 + 1 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 33 + 1 + 1 + 1 + 1 + 2 + 1 + 1 + 1 + 33 + 1 + 1 // P2PKHPkScriptSize is the size of a transaction output script that // pays to a compressed pubkey hash. It is calculated as: // // - OP_DUP // - OP_HASH160 // - OP_DATA_20 // - 20 bytes pubkey hash // - OP_EQUALVERIFY // - OP_CHECKSIG P2PKHPkScriptSize = 1 + 1 + 1 + 20 + 1 + 1 // RedeemP2PKHInputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2PKH output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - signature script // - 4 bytes sequence RedeemP2PKHInputSize = 32 + 4 + 1 + RedeemP2PKHSigScriptSize + 4 // RedeemP2SH2of3MultisigInputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2SH 2 of 3 multisig output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SH2of3MultisigInputSize = 32 + 4 + 1 + 4 + (RedeemP2SH2of3MultisigSigScriptSize / 4) // RedeemP2SH1of2MultisigInputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2SH 2 of 3 multisig output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SH1of2MultisigInputSize = 32 + 4 + 1 + 4 + (RedeemP2SH1of2MultisigSigScriptSize / 4) // RedeemP2SHMultisigTimelock1InputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed p2sh timelocked multig output with using the timeout. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SHMultisigTimelock1InputSize = 32 + 4 + 1 + 4 + (RedeemP2SHMultisigTimelock1SigScriptSize / 4) // RedeemP2SHMultisigTimelock2InputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2SH timelocked multisig output without using the timeout. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SHMultisigTimelock2InputSize = 32 + 4 + 1 + 4 + (RedeemP2SHMultisigTimelock2SigScriptSize / 4) // P2PKHOutputSize is the serialize size of a transaction output with a // P2PKH output script. It is calculated as: // // - 8 bytes output value // - 1 byte compact int encoding value 25 // - 25 bytes P2PKH output script P2PKHOutputSize = 8 + 1 + P2PKHPkScriptSize )
Worst case script and input/output size estimates.
Variables ¶
View Source
var (
ZcashCurrencyDefinition = wi.CurrencyDefinition{
Code: "ZEC",
Divisibility: 8,
}
)
Functions ¶
func EstimateSerializeSize ¶
func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool, inputType InputType) int
EstimateSerializeSize returns a worst case serialize size estimate for a signed transaction that spends inputCount number of compressed P2PKH outputs and contains each transaction output from txOuts. The estimated size is incremented for an additional P2PKH change output if addChangeOutput is true.
func SumOutputSerializeSizes ¶
SumOutputSerializeSizes sums up the serialized size of the supplied outputs.
Types ¶
type BitfinexDecoder ¶
type BitfinexDecoder struct{}
type BittrexDecoder ¶
type BittrexDecoder struct{}
type ExchangeRateDecoder ¶
type ExchangeRateDecoder interface {
// contains filtered or unexported methods
}
type ExchangeRateProvider ¶
type ExchangeRateProvider struct {
// contains filtered or unexported fields
}
type KrakenDecoder ¶
type KrakenDecoder struct{}
type OpenBazaarDecoder ¶
type OpenBazaarDecoder struct{}
type PoloniexDecoder ¶
type PoloniexDecoder struct{}
type ZCashWallet ¶
type ZCashWallet struct {
// contains filtered or unexported fields
}
func NewZCashWallet ¶
func (*ZCashWallet) AddTransactionListener ¶
func (w *ZCashWallet) AddTransactionListener(callback func(wi.TransactionCallback))
func (*ZCashWallet) AddWatchedAddresses ¶
func (w *ZCashWallet) AddWatchedAddresses(addrs ...btcutil.Address) error
func (*ZCashWallet) AddWatchedScript ¶
func (w *ZCashWallet) AddWatchedScript(script []byte) error
func (*ZCashWallet) AddressToScript ¶
func (w *ZCashWallet) AddressToScript(addr btcutil.Address) ([]byte, error)
func (*ZCashWallet) AssociateTransactionWithOrder ¶
func (w *ZCashWallet) AssociateTransactionWithOrder(cb wi.TransactionCallback)
AssociateTransactionWithOrder used for ORDER_PAYMENT message
func (*ZCashWallet) Balance ¶
func (w *ZCashWallet) Balance() (wi.CurrencyValue, wi.CurrencyValue)
func (*ZCashWallet) Broadcast ¶
func (w *ZCashWallet) Broadcast(tx *wire.MsgTx) (string, error)
Build a client.Transaction so we can ingest it into the wallet service then broadcast
func (*ZCashWallet) ChildKey ¶
func (w *ZCashWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey bool) (*hd.ExtendedKey, error)
func (*ZCashWallet) Close ¶
func (w *ZCashWallet) Close()
func (*ZCashWallet) CreateMultisigSignature ¶
func (w *ZCashWallet) CreateMultisigSignature(ins []wi.TransactionInput, outs []wi.TransactionOutput, key *hd.ExtendedKey, redeemScript []byte, feePerByte big.Int) ([]wi.Signature, error)
func (*ZCashWallet) CurrencyCode ¶
func (w *ZCashWallet) CurrencyCode() string
func (*ZCashWallet) CurrentAddress ¶
func (w *ZCashWallet) CurrentAddress(purpose wi.KeyPurpose) btcutil.Address
func (*ZCashWallet) DecodeAddress ¶
func (w *ZCashWallet) DecodeAddress(addr string) (btcutil.Address, error)
func (*ZCashWallet) DumpTables ¶
func (w *ZCashWallet) DumpTables(wr io.Writer)
func (*ZCashWallet) EstimateFee ¶
func (w *ZCashWallet) EstimateFee(ins []wi.TransactionInput, outs []wi.TransactionOutput, feePerByte big.Int) big.Int
func (*ZCashWallet) EstimateSpendFee ¶
func (*ZCashWallet) ExchangeRates ¶
func (w *ZCashWallet) ExchangeRates() wi.ExchangeRates
func (*ZCashWallet) GenerateMultisigScript ¶
func (w *ZCashWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, timeoutKey *hd.ExtendedKey) (addr btcutil.Address, redeemScript []byte, err error)
func (*ZCashWallet) GetConfirmations ¶
func (*ZCashWallet) GetFeePerByte ¶
func (w *ZCashWallet) GetFeePerByte(feeLevel wi.FeeLevel) big.Int
func (*ZCashWallet) GetTransaction ¶
func (*ZCashWallet) MasterPrivateKey ¶
func (w *ZCashWallet) MasterPrivateKey() *hd.ExtendedKey
func (*ZCashWallet) MasterPublicKey ¶
func (w *ZCashWallet) MasterPublicKey() *hd.ExtendedKey
func (*ZCashWallet) Multisign ¶
func (w *ZCashWallet) Multisign(ins []wi.TransactionInput, outs []wi.TransactionOutput, sigs1 []wi.Signature, sigs2 []wi.Signature, redeemScript []byte, feePerByte big.Int, broadcast bool) ([]byte, error)
func (*ZCashWallet) NewAddress ¶
func (w *ZCashWallet) NewAddress(purpose wi.KeyPurpose) btcutil.Address
func (*ZCashWallet) Params ¶
func (w *ZCashWallet) Params() *chaincfg.Params
func (*ZCashWallet) ReSyncBlockchain ¶
func (w *ZCashWallet) ReSyncBlockchain(fromTime time.Time)
func (*ZCashWallet) ScriptToAddress ¶
func (w *ZCashWallet) ScriptToAddress(script []byte) (btcutil.Address, error)
func (*ZCashWallet) Start ¶
func (w *ZCashWallet) Start()
func (*ZCashWallet) SweepAddress ¶
func (w *ZCashWallet) SweepAddress(ins []wi.TransactionInput, address *btcutil.Address, key *hd.ExtendedKey, redeemScript *[]byte, feeLevel wi.FeeLevel) (*chainhash.Hash, error)
func (*ZCashWallet) Transactions ¶
func (w *ZCashWallet) Transactions() ([]wi.Txn, error)
type ZcashPriceFetcher ¶
func NewZcashPriceFetcher ¶
func NewZcashPriceFetcher(dialer proxy.Dialer) *ZcashPriceFetcher
func (*ZcashPriceFetcher) GetAllRates ¶
func (z *ZcashPriceFetcher) GetAllRates(cacheOK bool) (map[string]float64, error)
func (*ZcashPriceFetcher) GetExchangeRate ¶
func (z *ZcashPriceFetcher) GetExchangeRate(currencyCode string) (float64, error)
func (*ZcashPriceFetcher) GetLatestRate ¶
func (z *ZcashPriceFetcher) GetLatestRate(currencyCode string) (float64, error)
func (*ZcashPriceFetcher) UnitsPerCoin ¶
func (z *ZcashPriceFetcher) UnitsPerCoin() int64
Click to show internal directories.
Click to hide internal directories.