Documentation ¶
Index ¶
- Constants
- func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool, ...) int
- func SumOutputSerializeSizes(outputs []*wire.TxOut) (serializeSize int)
- type BitcoinCashPriceFetcher
- func (b *BitcoinCashPriceFetcher) GetAllRates(cacheOK bool) (map[string]float64, error)
- func (b *BitcoinCashPriceFetcher) GetExchangeRate(currencyCode string) (float64, error)
- func (b *BitcoinCashPriceFetcher) GetLatestRate(currencyCode string) (float64, error)
- func (b *BitcoinCashPriceFetcher) Run()
- func (b *BitcoinCashPriceFetcher) UnitsPerCoin() int
- type BitcoinCashWallet
- func (w *BitcoinCashWallet) AddTransactionListener(callback func(wi.TransactionCallback))
- func (w *BitcoinCashWallet) AddWatchedAddresses(addrs ...btcutil.Address) error
- func (w *BitcoinCashWallet) AddWatchedScript(script []byte) error
- func (w *BitcoinCashWallet) AddressToScript(addr btcutil.Address) ([]byte, error)
- func (w *BitcoinCashWallet) AssociateTransactionWithOrder(cb wi.TransactionCallback)
- func (w *BitcoinCashWallet) Balance() (confirmed, unconfirmed int64)
- func (w *BitcoinCashWallet) Broadcast(tx *wire.MsgTx) error
- func (w *BitcoinCashWallet) BumpFee(txid chainhash.Hash) (*chainhash.Hash, error)
- func (w *BitcoinCashWallet) ChainTip() (uint32, chainhash.Hash)
- func (w *BitcoinCashWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey bool) (*hd.ExtendedKey, error)
- func (w *BitcoinCashWallet) Close()
- func (w *BitcoinCashWallet) CreateMultisigSignature(ins []wi.TransactionInput, outs []wi.TransactionOutput, key *hd.ExtendedKey, ...) ([]wi.Signature, error)
- func (w *BitcoinCashWallet) CurrencyCode() string
- func (w *BitcoinCashWallet) CurrentAddress(purpose wi.KeyPurpose) btcutil.Address
- func (w *BitcoinCashWallet) DecodeAddress(addr string) (btcutil.Address, error)
- func (w *BitcoinCashWallet) DumpTables(wr io.Writer)
- func (w *BitcoinCashWallet) EstimateFee(ins []wi.TransactionInput, outs []wi.TransactionOutput, feePerByte uint64) uint64
- func (w *BitcoinCashWallet) EstimateSpendFee(amount int64, feeLevel wi.FeeLevel) (uint64, error)
- func (w *BitcoinCashWallet) ExchangeRates() wi.ExchangeRates
- func (w *BitcoinCashWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, ...) (addr btcutil.Address, redeemScript []byte, err error)
- func (w *BitcoinCashWallet) GetConfirmations(txid chainhash.Hash) (uint32, uint32, error)
- func (w *BitcoinCashWallet) GetFeePerByte(feeLevel wi.FeeLevel) uint64
- func (w *BitcoinCashWallet) GetTransaction(txid chainhash.Hash) (wi.Txn, error)
- func (w *BitcoinCashWallet) HasKey(addr btcutil.Address) bool
- func (w *BitcoinCashWallet) IsDust(amount int64) bool
- func (w *BitcoinCashWallet) MasterPrivateKey() *hd.ExtendedKey
- func (w *BitcoinCashWallet) MasterPublicKey() *hd.ExtendedKey
- func (w *BitcoinCashWallet) Multisign(ins []wi.TransactionInput, outs []wi.TransactionOutput, sigs1 []wi.Signature, ...) ([]byte, error)
- func (w *BitcoinCashWallet) NewAddress(purpose wi.KeyPurpose) btcutil.Address
- func (w *BitcoinCashWallet) Params() *chaincfg.Params
- func (w *BitcoinCashWallet) ReSyncBlockchain(fromTime time.Time)
- func (w *BitcoinCashWallet) ScriptToAddress(script []byte) (btcutil.Address, error)
- func (w *BitcoinCashWallet) Spend(amount int64, addr btcutil.Address, feeLevel wi.FeeLevel, referenceID string, ...) (*chainhash.Hash, error)
- func (w *BitcoinCashWallet) Start()
- func (w *BitcoinCashWallet) SweepAddress(ins []wi.TransactionInput, address *btcutil.Address, key *hd.ExtendedKey, ...) (*chainhash.Hash, error)
- func (w *BitcoinCashWallet) Transactions() ([]wi.Txn, error)
- type ExchangeRateDecoder
- type ExchangeRateProvider
- type InputType
- type OpenBazaarDecoder
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 ¶
This section is empty.
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 BitcoinCashPriceFetcher ¶
func NewBitcoinCashPriceFetcher ¶
func NewBitcoinCashPriceFetcher(dialer proxy.Dialer) *BitcoinCashPriceFetcher
func (*BitcoinCashPriceFetcher) GetAllRates ¶
func (b *BitcoinCashPriceFetcher) GetAllRates(cacheOK bool) (map[string]float64, error)
func (*BitcoinCashPriceFetcher) GetExchangeRate ¶
func (b *BitcoinCashPriceFetcher) GetExchangeRate(currencyCode string) (float64, error)
func (*BitcoinCashPriceFetcher) GetLatestRate ¶
func (b *BitcoinCashPriceFetcher) GetLatestRate(currencyCode string) (float64, error)
func (*BitcoinCashPriceFetcher) Run ¶
func (b *BitcoinCashPriceFetcher) Run()
func (*BitcoinCashPriceFetcher) UnitsPerCoin ¶
func (b *BitcoinCashPriceFetcher) UnitsPerCoin() int
type BitcoinCashWallet ¶
type BitcoinCashWallet struct {
// contains filtered or unexported fields
}
func NewBitcoinCashWallet ¶
func (*BitcoinCashWallet) AddTransactionListener ¶
func (w *BitcoinCashWallet) AddTransactionListener(callback func(wi.TransactionCallback))
func (*BitcoinCashWallet) AddWatchedAddresses ¶
func (w *BitcoinCashWallet) AddWatchedAddresses(addrs ...btcutil.Address) error
func (*BitcoinCashWallet) AddWatchedScript ¶
func (w *BitcoinCashWallet) AddWatchedScript(script []byte) error
func (*BitcoinCashWallet) AddressToScript ¶
func (w *BitcoinCashWallet) AddressToScript(addr btcutil.Address) ([]byte, error)
func (*BitcoinCashWallet) AssociateTransactionWithOrder ¶
func (w *BitcoinCashWallet) AssociateTransactionWithOrder(cb wi.TransactionCallback)
AssociateTransactionWithOrder used for ORDER_PAYMENT message
func (*BitcoinCashWallet) Balance ¶
func (w *BitcoinCashWallet) Balance() (confirmed, unconfirmed int64)
func (*BitcoinCashWallet) Broadcast ¶
func (w *BitcoinCashWallet) Broadcast(tx *wire.MsgTx) error
Build a client.Transaction so we can ingest it into the wallet service then broadcast
func (*BitcoinCashWallet) ChainTip ¶
func (w *BitcoinCashWallet) ChainTip() (uint32, chainhash.Hash)
func (*BitcoinCashWallet) ChildKey ¶
func (w *BitcoinCashWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey bool) (*hd.ExtendedKey, error)
func (*BitcoinCashWallet) Close ¶
func (w *BitcoinCashWallet) Close()
func (*BitcoinCashWallet) CreateMultisigSignature ¶
func (w *BitcoinCashWallet) CreateMultisigSignature(ins []wi.TransactionInput, outs []wi.TransactionOutput, key *hd.ExtendedKey, redeemScript []byte, feePerByte uint64) ([]wi.Signature, error)
func (*BitcoinCashWallet) CurrencyCode ¶
func (w *BitcoinCashWallet) CurrencyCode() string
func (*BitcoinCashWallet) CurrentAddress ¶
func (w *BitcoinCashWallet) CurrentAddress(purpose wi.KeyPurpose) btcutil.Address
func (*BitcoinCashWallet) DecodeAddress ¶
func (w *BitcoinCashWallet) DecodeAddress(addr string) (btcutil.Address, error)
func (*BitcoinCashWallet) DumpTables ¶
func (w *BitcoinCashWallet) DumpTables(wr io.Writer)
func (*BitcoinCashWallet) EstimateFee ¶
func (w *BitcoinCashWallet) EstimateFee(ins []wi.TransactionInput, outs []wi.TransactionOutput, feePerByte uint64) uint64
func (*BitcoinCashWallet) EstimateSpendFee ¶
func (*BitcoinCashWallet) ExchangeRates ¶
func (w *BitcoinCashWallet) ExchangeRates() wi.ExchangeRates
func (*BitcoinCashWallet) GenerateMultisigScript ¶
func (w *BitcoinCashWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, timeoutKey *hd.ExtendedKey) (addr btcutil.Address, redeemScript []byte, err error)
func (*BitcoinCashWallet) GetConfirmations ¶
func (*BitcoinCashWallet) GetFeePerByte ¶
func (w *BitcoinCashWallet) GetFeePerByte(feeLevel wi.FeeLevel) uint64
func (*BitcoinCashWallet) GetTransaction ¶
func (*BitcoinCashWallet) IsDust ¶
func (w *BitcoinCashWallet) IsDust(amount int64) bool
func (*BitcoinCashWallet) MasterPrivateKey ¶
func (w *BitcoinCashWallet) MasterPrivateKey() *hd.ExtendedKey
func (*BitcoinCashWallet) MasterPublicKey ¶
func (w *BitcoinCashWallet) MasterPublicKey() *hd.ExtendedKey
func (*BitcoinCashWallet) Multisign ¶
func (w *BitcoinCashWallet) Multisign(ins []wi.TransactionInput, outs []wi.TransactionOutput, sigs1 []wi.Signature, sigs2 []wi.Signature, redeemScript []byte, feePerByte uint64, broadcast bool) ([]byte, error)
func (*BitcoinCashWallet) NewAddress ¶
func (w *BitcoinCashWallet) NewAddress(purpose wi.KeyPurpose) btcutil.Address
func (*BitcoinCashWallet) Params ¶
func (w *BitcoinCashWallet) Params() *chaincfg.Params
func (*BitcoinCashWallet) ReSyncBlockchain ¶
func (w *BitcoinCashWallet) ReSyncBlockchain(fromTime time.Time)
func (*BitcoinCashWallet) ScriptToAddress ¶
func (w *BitcoinCashWallet) ScriptToAddress(script []byte) (btcutil.Address, error)
func (*BitcoinCashWallet) Start ¶
func (w *BitcoinCashWallet) Start()
func (*BitcoinCashWallet) SweepAddress ¶
func (w *BitcoinCashWallet) SweepAddress(ins []wi.TransactionInput, address *btcutil.Address, key *hd.ExtendedKey, redeemScript *[]byte, feeLevel wi.FeeLevel) (*chainhash.Hash, error)
func (*BitcoinCashWallet) Transactions ¶
func (w *BitcoinCashWallet) Transactions() ([]wi.Txn, error)
type ExchangeRateDecoder ¶
type ExchangeRateDecoder interface {
// contains filtered or unexported methods
}
type ExchangeRateProvider ¶
type ExchangeRateProvider struct {
// contains filtered or unexported fields
}
type OpenBazaarDecoder ¶
type OpenBazaarDecoder struct{}
Click to show internal directories.
Click to hide internal directories.