Documentation ¶
Index ¶
Constants ¶
const Version int32 = 4
Version of Zcash transactions supported by the multichain.
Variables ¶
var ( // MainNetParams defines the mainnet configuration. 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}}, {903000, []byte{0x0B, 0x23, 0xB9, 0xF5}}, {1046400, []byte{0xA6, 0x75, 0xff, 0xe9}}, }, } // TestNet3Params defines the testnet configuration. 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}}, {903800, []byte{0x0B, 0x23, 0xB9, 0xF5}}, {1028500, []byte{0xA6, 0x75, 0xff, 0xe9}}, }, } // RegressionNetParams defines a devet/regnet configuration. RegressionNetParams = Params{ Params: &chaincfg.RegressionNetParams, P2PKHPrefix: []byte{0x1D, 0x25}, P2SHPrefix: []byte{0x1C, 0xBA}, Upgrades: []ParamsUpgrade{ {0, []byte{0x00, 0x00, 0x00, 0x00}}, {10, []byte{0x19, 0x1B, 0xA8, 0x5B}}, {20, []byte{0xBB, 0x09, 0xB8, 0x76}}, {30, []byte{0x60, 0x0E, 0xB4, 0x2B}}, {40, []byte{0x0B, 0x23, 0xB9, 0xF5}}, {50, []byte{0xA6, 0x75, 0xff, 0xe9}}, }, } )
var NewClient = bitcoin.NewClient
NewClient re-exports bitcoin.Client
var NewGasEstimator = bitcoin.NewGasEstimator
NewGasEstimator re-exports bitcoin.NewGasEstimator
Functions ¶
Types ¶
type Address ¶ added in v0.2.0
An Address represents a Zcash address.
func DecodeAddress ¶ added in v0.2.0
DecodeAddress decodes a string-representation of an address to an address type that implements the zcash.Address interface
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
ClientOptions are used to parameterise the behaviour of the Client.
func DefaultClientOptions ¶ added in v0.2.0
func DefaultClientOptions() ClientOptions
DefaultClientOptions returns ClientOptions with the default settings. These settings are valid for use with the default local deployment of the multichain. In production, the host, user, and password should be changed.
type GasEstimator ¶ added in v0.2.0
type GasEstimator = bitcoin.GasEstimator
GasEstimator re-exports 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 }
Params signifies the chain specific parameters of the Zcash network.
type ParamsUpgrade ¶ added in v0.2.0
ParamsUpgrade ...
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx represents a simple Zcash transaction that implements the Bitcoin Compat API.
func (*Tx) Outputs ¶ added in v0.2.0
Outputs returns the UTXO outputs in the underlying transaction.
type TxBuilder ¶ added in v0.2.0
type TxBuilder struct {
// contains filtered or unexported fields
}
The TxBuilder is an implementation of a UTXO-compatible transaction builder for Bitcoin.
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.