Documentation ¶
Overview ¶
Package btcrpc implements RPC methods to interact with the bitcoin node bitcoind. See informations in the pages link below about Bitcoin development. https://bitcoin.org/en/development
Index ¶
- type BasicAuth
- type Block
- type RPCClient
- func (c *RPCClient) DecodeRawTransactions(rawTxs []string) ([]*Transaction, error)
- func (c *RPCClient) GetBalance(address string) (float32, error)
- func (c *RPCClient) GetBlock(h string) (*Block, error)
- func (c *RPCClient) GetBlockCount() (int32, error)
- func (c *RPCClient) GetBlockHash(height int32) (string, error)
- func (c *RPCClient) GetNewAddress(account string) (string, error)
- func (c *RPCClient) GetRawTransactions(txids []string) ([]string, error)
- type RPCer
- type ScriptPubKey
- type ScriptSig
- type Transaction
- type Vin
- type VinCoinbaseTransaction
- type VinTransaction
- type Vout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAuth ¶
BasicAuth is for Bitcoin Node supports basic auth. Some nodes do not need this. In that case, leave these blank.
type Block ¶
type Block struct { Hash string `json:"hash"` Version int32 `json:"version"` Txs []string `json:"txs"` Time int32 `json:"time"` Size int32 `json:"size"` Nonce int32 `json:"nonce"` Weight int32 `json:"weight"` VersionHex string `json:"versionHex"` Difficulty int32 `json:"difficulty"` Mediantime int32 `json:"mediantime"` Chainwork string `json:"chainwork"` Strippedsize int32 `json:"strippedsize"` Merkleroot string `json:"merkleroot"` Bits string `json:"bits"` NextBlockhash string `json:"nextBlockhash"` Confirmations int32 `json:"confirmations"` Height int32 `json:"height"` }
Block ...
type RPCClient ¶
RPCClient ...
func NewRPCClient ¶
NewRPCClient creates JSONRPC clients for your bitcoin node.
func (*RPCClient) DecodeRawTransactions ¶
func (c *RPCClient) DecodeRawTransactions(rawTxs []string) ([]*Transaction, error)
DecodeRawTransactions decodes the raw transactions to human readable transactions.
func (*RPCClient) GetBalance ¶
GetBalance gets the balance of the address. It is only possible to get the balance which is made by this node, otherwise it will return 0.00.
func (*RPCClient) GetBlock ¶
GetBlock gets the block information associated with the block hash(id). It contains a lot of infos about transactions.
func (*RPCClient) GetBlockCount ¶
GetBlockCount gets the latest block height. Note that The methods name is "Count" not "Height".
func (*RPCClient) GetBlockHash ¶
GetBlockHash gets the block hash(id) associated with the block height.
func (*RPCClient) GetNewAddress ¶
GetNewAddress gets new address associated with the account name given. If the account name is blank(nil), if will also returns a addresss with no associated account.
type ScriptPubKey ¶
type ScriptPubKey struct { Asm string `json:"asm"` Hex string `json:"hex"` ReqSigs int32 `json:"reqSigs"` Type string `json:"type"` Addresses []string `json:"addresses"` }
ScriptPubKey ...
type Transaction ¶
type Transaction struct { Txid string `json:"txid"` Hash string `json:"hash"` Version int32 `json:"id"` Size int32 `json:"size"` Vsize int32 `json:"vsize"` Locktime int32 `json:"locktime"` Vins Vin Vouts []Vout }
Transaction ...
type VinCoinbaseTransaction ¶
type VinCoinbaseTransaction struct { Coinbase string `json:"coinbase"` Sequence int64 `json:"sequence"` }
VinCoinbaseTransaction is a struct of Vins(inputs) with mining.
type VinTransaction ¶
type VinTransaction struct { Txid string `json:"txid"` Vout int32 `json:"vout"` ScriptSig ScriptSig TxinWitness []string `json:"txinWitness"` Sequence int64 `json:"Sequence"` }
VinTransaction is a struct of Vin(inputs) with normal transaction.
type Vout ¶
type Vout struct { Value float32 `json:"value"` N int32 `json:"n"` ScriptPubKey ScriptPubKey }
Vout ...