Documentation ¶
Index ¶
Constants ¶
const Version int32 = 4
Version of Zcash transactions supported by the multichain.
Variables ¶
var ( MainNetParams = Params{ Params: &chaincfg.MainNetParams, P2PKHPrefix: []byte{0x1C, 0xB8}, P2SHPrefix: []byte{0x1C, 0xBD}, Upgrades: []ParamsUpgrade{ {0, []byte{0x00, 0x00, 0x00, 0x00}}, {347500, []byte{0x19, 0x1B, 0xA8, 0x5B}}, {419200, []byte{0xBB, 0x09, 0xB8, 0x76}}, {653600, []byte{0x60, 0x0E, 0xB4, 0x2B}}, }, } TestNet3Params = Params{ Params: &chaincfg.TestNet3Params, P2PKHPrefix: []byte{0x1D, 0x25}, P2SHPrefix: []byte{0x1C, 0xBA}, Upgrades: []ParamsUpgrade{ {0, []byte{0x00, 0x00, 0x00, 0x00}}, {207500, []byte{0x19, 0x1B, 0xA8, 0x5B}}, {280000, []byte{0xBB, 0x09, 0xB8, 0x76}}, {584000, []byte{0x60, 0x0E, 0xB4, 0x2B}}, }, } RegressionNetParams = Params{ Params: &chaincfg.RegressionNetParams, P2PKHPrefix: []byte{0x1D, 0x25}, P2SHPrefix: []byte{0x1C, 0xBA}, Upgrades: []ParamsUpgrade{ {0, []byte{0x00, 0x00, 0x00, 0x00}}, {60, []byte{0x19, 0x1B, 0xA8, 0x5B}}, {80, []byte{0xBB, 0x09, 0xB8, 0x76}}, {100, []byte{0x60, 0x0E, 0xB4, 0x2B}}, }, } )
var NewClient = bitcoin.NewClient
var NewGasEstimator = bitcoin.NewGasEstimator
Functions ¶
Types ¶
type Address ¶ added in v0.2.0
An Address represents a Zcash address.
func DecodeAddress ¶ added in v0.2.0
type AddressPubKeyHash ¶
type AddressPubKeyHash struct { *btcutil.AddressPubKeyHash // contains filtered or unexported fields }
AddressPubKeyHash represents an address for P2PKH transactions for Zcash that is compatible with the Bitcoin Compat API.
func NewAddressPubKeyHash ¶
func NewAddressPubKeyHash(pkh []byte, params *Params) (AddressPubKeyHash, error)
NewAddressPubKeyHash returns a new AddressPubKeyHash that is compatible with the Bitcoin Compat API.
func (AddressPubKeyHash) BitcoinAddress ¶ added in v0.2.0
func (addr AddressPubKeyHash) BitcoinAddress() btcutil.Address
BitcoinAddress returns the address as if it was a Bitcoin address.
func (AddressPubKeyHash) EncodeAddress ¶
func (addr AddressPubKeyHash) EncodeAddress() string
EncodeAddress returns the string encoding of the payment address associated with the Address value. See the comment on String for how this method differs from String.
func (AddressPubKeyHash) IsForNet ¶
func (addr AddressPubKeyHash) IsForNet(params *chaincfg.Params) bool
IsForNet returns whether or not the address is associated with the passed bitcoin network.
func (AddressPubKeyHash) ScriptAddress ¶
func (addr AddressPubKeyHash) ScriptAddress() []byte
ScriptAddress returns the raw bytes of the address to be used when inserting the address into a txout's script.
func (AddressPubKeyHash) String ¶
func (addr AddressPubKeyHash) String() string
String returns the string encoding of the transaction output destination.
Please note that String differs subtly from EncodeAddress: String will return the value as a string without any conversion, while EncodeAddress may convert destination types (for example, converting pubkeys to P2PKH addresses) before encoding as a payment address string.
type AddressScriptHash ¶ added in v0.2.0
type AddressScriptHash struct { *btcutil.AddressScriptHash // contains filtered or unexported fields }
AddressScriptHash represents an address for P2SH transactions for Zcash that is compatible with the Bitcoin Compat API.
func NewAddressScriptHash ¶ added in v0.2.0
func NewAddressScriptHash(script []byte, params *Params) (AddressScriptHash, error)
NewAddressScriptHash returns a new AddressScriptHash that is compatible with the Bitcoin Compat API.
func NewAddressScriptHashFromHash ¶ added in v0.2.0
func NewAddressScriptHashFromHash(scriptHash []byte, params *Params) (AddressScriptHash, error)
NewAddressScriptHashFromHash returns a new AddressScriptHash that is compatible with the Bitcoin Compat API.
func (AddressScriptHash) BitcoinAddress ¶ added in v0.2.0
func (addr AddressScriptHash) BitcoinAddress() btcutil.Address
BitcoinAddress returns the address as if it was a Bitcoin address.
func (AddressScriptHash) EncodeAddress ¶ added in v0.2.0
func (addr AddressScriptHash) EncodeAddress() string
EncodeAddress returns the string encoding of the payment address associated with the Address value. See the comment on String for how this method differs from String.
func (AddressScriptHash) IsForNet ¶ added in v0.2.0
func (addr AddressScriptHash) IsForNet(params *chaincfg.Params) bool
IsForNet returns whether or not the address is associated with the passed bitcoin network.
func (AddressScriptHash) ScriptAddress ¶ added in v0.2.0
func (addr AddressScriptHash) ScriptAddress() []byte
ScriptAddress returns the raw bytes of the address to be used when inserting the address into a txout's script.
func (AddressScriptHash) String ¶ added in v0.2.0
func (addr AddressScriptHash) String() string
String returns the string encoding of the transaction output destination.
Please note that String differs subtly from EncodeAddress: String will return the value as a string without any conversion, while EncodeAddress may convert destination types (for example, converting pubkeys to P2PKH addresses) before encoding as a payment address string.
type ClientOptions ¶ added in v0.2.0
type ClientOptions = bitcoin.ClientOptions
func DefaultClientOptions ¶ added in v0.2.0
func DefaultClientOptions() ClientOptions
type GasEstimator ¶ added in v0.2.0
type GasEstimator = bitcoin.GasEstimator
type Params ¶ added in v0.2.0
type Params struct { // TODO: We do not actually need to embed the entire chaincfg params object. *chaincfg.Params P2SHPrefix []byte P2PKHPrefix []byte Upgrades []ParamsUpgrade }
type ParamsUpgrade ¶ added in v0.2.0
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx represents a simple Zcash transaction that implements the Bitcoin Compat API.
type TxBuilder ¶ added in v0.2.0
type TxBuilder struct {
// contains filtered or unexported fields
}
func (TxBuilder) BuildTx ¶ added in v0.2.0
func (txBuilder TxBuilder) BuildTx(inputs []utxo.Input, recipients []utxo.Recipient) (utxo.Tx, error)
BuildTx returns a simple Zcash transaction that consumes the funds from the given outputs, and sends the to the given recipients. The difference in the sum value of the inputs and the sum value of the recipients is paid as a fee to the Zcash network.
It is assumed that the required signature scripts require the SIGHASH_ALL signatures and the serialized public key:
builder := txscript.NewScriptBuilder() builder.AddData(append(signature.Serialize(), byte(txscript.SigHashAll|SighashForkID))) builder.AddData(serializedPubKey)
Outputs produced for recipients will use P2PKH, or P2SH scripts as the pubkey script, based on the format of the recipient address.