Documentation
¶
Index ¶
- Constants
- Variables
- func GetChainParams(chain string) *chaincfg.Params
- func NewNulsRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error)
- type CmdGetBestBlockHash
- type CmdGetBestBlockHeight
- type CmdGetBlock
- type CmdGetBlockHeader
- type CmdGetNetworkInfo
- type CmdGetTx
- type CmdGetTxBytes
- type CmdGetVersionInfo
- type CmdTxBroadcast
- type NulsParser
- func (p *NulsParser) DeriveAddressDescriptorsFromTo(descriptor *bchain.XpubDescriptor, change uint32, fromIndex uint32, ...) ([]bchain.AddressDescriptor, error)
- func (p *NulsParser) GetAddrDescFromAddress(address string) (bchain.AddressDescriptor, error)
- func (p *NulsParser) GetAddrDescFromVout(output *bchain.Vout) (bchain.AddressDescriptor, error)
- func (p *NulsParser) GetAddressesFromAddrDesc(addrDesc bchain.AddressDescriptor) ([]string, bool, error)
- func (p *NulsParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ([]byte, error)
- func (p *NulsParser) PackedTxidLen() int
- func (p *NulsParser) ParseTx(b []byte) (*bchain.Tx, error)
- func (p *NulsParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error)
- type NulsRPC
- func (b *NulsRPC) Call(uri string, res interface{}) error
- func (n *NulsRPC) EstimateFee(blocks int) (big.Int, error)
- func (n *NulsRPC) EstimateSmartFee(blocks int, conservative bool) (big.Int, error)
- func (n *NulsRPC) GetBestBlockHash() (string, error)
- func (n *NulsRPC) GetBestBlockHeight() (uint32, error)
- func (n *NulsRPC) GetBlock(hash string, height uint32) (*bchain.Block, error)
- func (n *NulsRPC) GetBlockHash(height uint32) (string, error)
- func (n *NulsRPC) GetBlockHeader(hash string) (*bchain.BlockHeader, error)
- func (n *NulsRPC) GetBlockHeaderByHeight(height uint32) (*bchain.BlockHeader, error)
- func (n *NulsRPC) GetBlockInfo(hash string) (*bchain.BlockInfo, error)
- func (n *NulsRPC) GetChainInfo() (*bchain.ChainInfo, error)
- func (n *NulsRPC) GetMempoolTransactions() ([]string, error)
- func (n *NulsRPC) GetTransaction(txid string) (*bchain.Tx, error)
- func (n *NulsRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error)
- func (n *NulsRPC) GetTransactionSpecific(tx *bchain.Tx) (json.RawMessage, error)
- func (n *NulsRPC) Initialize() error
- func (b *NulsRPC) Post(uri string, req interface{}, res interface{}) error
- func (n *NulsRPC) SendRawTransaction(tx string) (string, error)
- type Tx
Constants ¶
const ( MainnetMagic wire.BitcoinNet = 0xbd6b0cbf TestnetMagic wire.BitcoinNet = 0xffcae2ce RegtestMagic wire.BitcoinNet = 0xdcb7c1fc AddressHashLength = 24 )
magic numbers
Variables ¶
var ( MainNetParams chaincfg.Params TestNetParams chaincfg.Params RegtestParams chaincfg.Params )
chain parameters
Functions ¶
func GetChainParams ¶
GetChainParams contains network parameters for the main Gincoin network, the regression test Gincoin network, the test Gincoin network and the simulation test Gincoin network, in this order
func NewNulsRPC ¶
func NewNulsRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error)
NewNulsRPC returns new NulsRPC instance
Types ¶
type CmdGetBestBlockHash ¶
type CmdGetBestBlockHeight ¶
type CmdGetBlock ¶
type CmdGetBlock struct {
Success bool `json:"success"`
Data struct {
Hash string `json:"hash"`
PreHash string `json:"preHash"`
MerkleHash string `json:"merkleHash"`
StateRoot string `json:"stateRoot"`
Time int64 `json:"time"`
Height int64 `json:"height"`
TxCount int `json:"txCount"`
PackingAddress string `json:"packingAddress"`
ConfirmCount int `json:"confirmCount"`
ScriptSig string `json:"scriptSig"`
Size int `json:"size"`
Reward float64 `json:"reward"`
Fee float64 `json:"fee"`
TxList []Tx `json:"txList"`
} `json:"data"`
}
type CmdGetBlockHeader ¶
type CmdGetBlockHeader struct {
Success bool `json:"success"`
Data struct {
Hash string `json:"hash"`
PreHash string `json:"preHash"`
MerkleHash string `json:"merkleHash"`
StateRoot string `json:"stateRoot"`
Time int64 `json:"time"`
Height int64 `json:"height"`
TxCount int `json:"txCount"`
PackingAddress string `json:"packingAddress"`
ConfirmCount int `json:"confirmCount"`
ScriptSig string `json:"scriptSig"`
Size int `json:"size"`
Reward float64 `json:"reward"`
Fee float64 `json:"fee"`
} `json:"data"`
}
type CmdGetNetworkInfo ¶
type CmdGetTxBytes ¶
type CmdGetVersionInfo ¶
type CmdTxBroadcast ¶
type NulsParser ¶
type NulsParser struct {
*btc.BitcoinLikeParser
}
NulsParser handle
func NewNulsParser ¶
func NewNulsParser(params *chaincfg.Params, c *btc.Configuration) *NulsParser
NewNulsParser returns new NulsParser instance
func (*NulsParser) DeriveAddressDescriptorsFromTo ¶
func (p *NulsParser) DeriveAddressDescriptorsFromTo(descriptor *bchain.XpubDescriptor, change uint32, fromIndex uint32, toIndex uint32) ([]bchain.AddressDescriptor, error)
DeriveAddressDescriptorsFromTo derives address descriptors from given xpub for addresses in index range
func (*NulsParser) GetAddrDescFromAddress ¶
func (p *NulsParser) GetAddrDescFromAddress(address string) (bchain.AddressDescriptor, error)
GetAddrDescFromAddress returns internal address representation (descriptor) of given address
func (*NulsParser) GetAddrDescFromVout ¶
func (p *NulsParser) GetAddrDescFromVout(output *bchain.Vout) (bchain.AddressDescriptor, error)
GetAddrDescFromVout returns internal address representation (descriptor) of given transaction output
func (*NulsParser) GetAddressesFromAddrDesc ¶
func (p *NulsParser) GetAddressesFromAddrDesc(addrDesc bchain.AddressDescriptor) ([]string, bool, error)
GetAddressesFromAddrDesc returns addresses for given address descriptor with flag if the addresses are searchable
func (*NulsParser) PackedTxidLen ¶
func (p *NulsParser) PackedTxidLen() int
PackedTxidLen returns length in bytes of packed txid
type NulsRPC ¶
type NulsRPC struct {
*btc.BitcoinRPC
// contains filtered or unexported fields
}
NulsRPC is an interface to JSON-RPC bitcoind service
func (*NulsRPC) Call ¶
Call calls Backend RPC interface, using RPCMarshaler interface to marshall the request
func (*NulsRPC) EstimateSmartFee ¶
func (*NulsRPC) GetBestBlockHash ¶
func (*NulsRPC) GetBestBlockHeight ¶
func (*NulsRPC) GetBlockHeader ¶
func (n *NulsRPC) GetBlockHeader(hash string) (*bchain.BlockHeader, error)
func (*NulsRPC) GetBlockHeaderByHeight ¶
func (n *NulsRPC) GetBlockHeaderByHeight(height uint32) (*bchain.BlockHeader, error)
func (*NulsRPC) GetBlockInfo ¶
func (*NulsRPC) GetMempoolTransactions ¶
func (*NulsRPC) GetTransactionForMempool ¶
func (*NulsRPC) GetTransactionSpecific ¶
func (*NulsRPC) Initialize ¶
Initialize initializes GincoinRPC instance.
type Tx ¶
type Tx struct {
Hash string `json:"hash"`
Type int `json:"type"`
Time int64 `json:"time"`
BlockHeight int64 `json:"blockHeight"`
Fee float64 `json:"fee"`
Value float64 `json:"value"`
Remark string `json:"remark"`
ScriptSig string `json:"scriptSig"`
Status int `json:"status"`
ConfirmCount int `json:"confirmCount"`
Size int `json:"size"`
Inputs []struct {
FromHash string `json:"fromHash"`
FromIndex uint32 `json:"fromIndex"`
Address string `json:"address"`
Value float64 `json:"value"`
} `json:"inputs"`
Outputs []struct {
Address string `json:"address"`
Value int64 `json:"value"`
LockTime int64 `json:"lockTime"`
} `json:"outputs"`
}