Documentation
¶
Overview ¶
Package bitcoind is client librari for bitcoind JSON RPC API
Index ¶
- Constants
- Variables
- type Bitcoind
- func (b *Bitcoind) BackupWallet(destination string) error
- func (b *Bitcoind) CreateRawTransaction(inputs []*RawTransactionInput, output RawTransactionOutput) (rawtx string, err error)
- func (b *Bitcoind) DecodeRawTransaction(rawtx string) (decoded RawTransaction, err error)
- func (b *Bitcoind) DumpPrivKey(address string) (privKey string, err error)
- func (b *Bitcoind) EncryptWallet(passphrase string) error
- func (b *Bitcoind) EstimateFee(blocks int) (fee float64, err error)
- func (b *Bitcoind) FundRawTransaction(rawtx string) (*FundRawTransactionResponse, error)
- func (b *Bitcoind) GetAccount(address string) (account string, err error)
- func (b *Bitcoind) GetAccountAddress(account string) (address string, err error)
- func (b *Bitcoind) GetAddressesByAccount(account string) (addresses []string, err error)
- func (b *Bitcoind) GetBalance(account string, minconf uint64) (balance float64, err error)
- func (b *Bitcoind) GetBestBlockhash() (bestBlockHash string, err error)
- func (b *Bitcoind) GetBlock(blockHash string) (block Block, err error)
- func (b *Bitcoind) GetBlockCount() (count uint64, err error)
- func (b *Bitcoind) GetBlockHash(index uint64) (hash string, err error)
- func (b *Bitcoind) GetBlockTemplate(capabilities []string, mode string) (template string, err error)
- func (b *Bitcoind) GetConnectionCount() (count uint64, err error)
- func (b *Bitcoind) GetDifficulty() (difficulty float64, err error)
- func (b *Bitcoind) GetGenerate() (generate bool, err error)
- func (b *Bitcoind) GetHashesPerSec() (hashpersec float64, err error)
- func (b *Bitcoind) GetInfo() (i Info, err error)
- func (b *Bitcoind) GetMiningInfo() (miningInfo MiningInfo, err error)
- func (b *Bitcoind) GetNewAddress(account ...string) (addr string, err error)
- func (b *Bitcoind) GetNewBech32Address(account ...string) (addr string, err error)
- func (b *Bitcoind) GetNewLegacyAddress(account ...string) (addr string, err error)
- func (b *Bitcoind) GetNewP2SHAddress(account ...string) (addr string, err error)
- func (b *Bitcoind) GetPeerInfo() (peerInfo []Peer, err error)
- func (b *Bitcoind) GetRawChangeAddress(account ...string) (rawAddress string, err error)
- func (b *Bitcoind) GetRawMempool() (txID []string, err error)
- func (b *Bitcoind) GetRawTransaction(txID string, verbose bool) (rawTx interface{}, err error)
- func (b *Bitcoind) GetReceivedByAccount(account string, minconf uint32) (amount float64, err error)
- func (b *Bitcoind) GetReceivedByAddress(address string, minconf uint32) (amount float64, err error)
- func (b *Bitcoind) GetTransaction(txid string) (transaction Transaction, err error)
- func (b *Bitcoind) GetTxOut(txid string, n uint32, includeMempool bool) (transactionOut UTransactionOut, err error)
- func (b *Bitcoind) GetTxOutsetInfo() (txOutSet TransactionOutSet, err error)
- func (b *Bitcoind) GetWalletInfo() (i WalletInfo, err error)
- func (b *Bitcoind) GetWork(data ...string) (response interface{}, err error)
- func (b *Bitcoind) ImportPrivKey(privKey, label string, rescan bool) error
- func (b *Bitcoind) KeyPoolRefill() error
- func (b *Bitcoind) ListAccounts(minconf int32) (accounts map[string]float64, err error)
- func (b *Bitcoind) ListAddressGroupings() (list []ListAddressResult, err error)
- func (b *Bitcoind) ListLockUnspent() (unspendableOutputs []UnspendableOutput, err error)
- func (b *Bitcoind) ListReceivedByAccount(minConf uint32, includeEmpty bool) (list []ReceivedByAccount, err error)
- func (b *Bitcoind) ListReceivedByAddress(minConf uint32, includeEmpty bool) (list []ReceivedByAddress, err error)
- func (b *Bitcoind) ListSinceBlock(blockHash string, targetConfirmations uint32) (transaction []Transaction, err error)
- func (b *Bitcoind) ListTransactions(account string, count, from uint32) (transaction []Transaction, err error)
- func (b *Bitcoind) ListUnspent(minconf, maxconf int64) (transactions []UnspentOutput, err error)
- func (b *Bitcoind) LockUnspent(lock bool, outputs []UnspendableOutput) (success bool, err error)
- func (b *Bitcoind) Move(formAccount, toAccount string, amount float64, minconf uint32, comment string) (success bool, err error)
- func (b *Bitcoind) SendFrom(fromAccount, toAddress string, amount float64, minconf uint32, ...) (txID string, err error)
- func (b *Bitcoind) SendMany(fromAccount string, amounts map[string]float64, minconf uint32, comment string) (txID string, err error)
- func (b *Bitcoind) SendRawTransaction(signedtx string) (string, error)
- func (b *Bitcoind) SendToAddress(toAddress string, amount float64, comment, commentTo string) (txID string, err error)
- func (b *Bitcoind) SetAccount(address, account string) error
- func (b *Bitcoind) SetGenerate(generate bool, genProcLimit int32) error
- func (b *Bitcoind) SetTxFee(amount float64) error
- func (b *Bitcoind) SignMessage(address, message string) (sig string, err error)
- func (b *Bitcoind) SignRawTransaction(rawtx string) (signedtx string, err error)
- func (b *Bitcoind) SignRawTransactionWithWallet(rawtx string) (signedtx string, err error)
- func (b *Bitcoind) Stop() error
- func (b *Bitcoind) ValidateAddress(address string) (va ValidateAddressResponse, err error)
- func (b *Bitcoind) VerifyMessage(address, sign, message string) (success bool, err error)
- func (b *Bitcoind) WalletLock() error
- func (b *Bitcoind) WalletPassphrase(passPhrase string, timeout uint64) error
- func (b *Bitcoind) WalletPassphraseChange(oldPassphrase, newPassprhase string) error
- type Block
- type FundRawTransactionResponse
- type Info
- type ListAddressResult
- type MiningInfo
- type Peer
- type RawTransaction
- type RawTransactionInput
- type RawTransactionOutput
- type ReceivedByAccount
- type ReceivedByAddress
- type ScriptPubKey
- type ScriptSig
- type SignRawTransactionError
- type SignRawTransactionResponse
- type Transaction
- type TransactionCategory
- type TransactionDetails
- type TransactionOutSet
- type UTransactionOut
- type UnspendableOutput
- type UnspentOutput
- type ValidateAddressResponse
- type Vin
- type Vout
- type WalletInfo
- type Work
Constants ¶
const ( // Version represents bicoind package version Version = 0.1 // DefaultRPCClientTimeout represent http timeout for rcp client DefaultRPCClientTimeout = 30 )
Variables ¶
var ErrClientInInitialDownload = fmt.Errorf("RPC_CLIENT_IN_INITIAL_DOWNLOAD") // -10, //!< Still downloading initial blocks
var ErrClientInvalidIPOrSubnet = fmt.Errorf("RPC_CLIENT_INVALID_IP_OR_SUBNET") // -30, //!< Invalid IP/Subnet
var ErrClientNodeAlreadyAdded = fmt.Errorf("RPC_CLIENT_NODE_ALREADY_ADDED") // -23, //!< Node is already added
var ErrClientNodeNotAdded = fmt.Errorf("RPC_CLIENT_NODE_NOT_ADDED") // -24, //!< Node has not been added before
var ErrClientNodeNotConnected = fmt.Errorf("RPC_CLIENT_NODE_NOT_CONNECTED") // -29, //!< Node to disconnect not found in connected nodes
var ErrClientNotConnected = fmt.Errorf("RPC_CLIENT_NOT_CONNECTED") // -9, //!< Bitcoin is not connected
! P2P client errors
var ErrClientP2PDisabled = fmt.Errorf("RPC_CLIENT_P2P_DISABLED") // -31, //!< No valid connection manager instance found
var ErrDatabaseError = fmt.Errorf("RPC_DATABASE_ERROR") // -20, //!< Database error
var ErrDeserialzationError = fmt.Errorf("RPC_DESERIALIZATION_ERROR") // -22, //!< Error parsing or validating structure in raw format
var ErrInWarmup = fmt.Errorf("RPC_IN_WARMUP") // -28, //!< Client still warming up
var ErrInsufficientFunds = fmt.Errorf("RPC_WALLET_INSUFFICIENT_FUNDS") // -6, //!< Not enough funds in wallet or account
var ErrInternalError = fmt.Errorf("RPC_INTERNAL_ERROR") // -32603,
RPC_INTERNAL_ERROR should only be used for genuine errors in bitcoind (for example datadir corruption).
var ErrInvalidAddressOrKey = fmt.Errorf("RPC_INVALID_ADDRESS_OR_KEY") // -5, //!< Invalid address or key
var ErrInvalidParameter = fmt.Errorf("RPC_INVALID_PARAMETER") // -8, //!< Invalid, missing or duplicate parameter
var ErrInvalidParams = fmt.Errorf("RPC_INVALID_PARAMS") // -32602,
var ErrInvalidRequest = fmt.Errorf("RPC_INVALID_REQUEST") // -32600,
! Standard JSON-RPC 2.0 errors RPC_INVALID_REQUEST is internally mapped to HTTP_BAD_REQUEST (400). It should not be used for application-layer errors.
var ErrMap = map[int16]error{ -32600: ErrInvalidRequest, -32601: ErrMethodNotFound, -32602: ErrInvalidParams, -32603: ErrInternalError, -32700: ErrParseError, -1: ErrMiscError, -3: ErrTypeError, -5: ErrInvalidAddressOrKey, -7: ErrOutOfMemory, -8: ErrInvalidParameter, -20: ErrDatabaseError, -22: ErrDeserialzationError, -25: ErrVerifyError, -26: ErrVerifyRejected, -27: ErrVerifyAlreadyInChain, -28: ErrInWarmup, -32: ErrMethodDepricated, -9: ErrClientNotConnected, -10: ErrClientInInitialDownload, -23: ErrClientNodeAlreadyAdded, -24: ErrClientNodeNotAdded, -29: ErrClientNodeNotConnected, -30: ErrClientInvalidIPOrSubnet, -31: ErrClientP2PDisabled, -4: ErrWalletError, -6: ErrInsufficientFunds, -11: ErrWalletInvalidLabelName, -12: ErrWalletKeypoolRanOut, -13: ErrWalletUnlockNeeded, -14: ErrWalletPassphraseIncorrect, -15: ErrWalletWrongEncState, -16: ErrWalletEncryptionFailed, -17: ErrWalletAlreadyUnlocked, -18: ErrWalletNotFound, -19: ErrWalletNotSpecified, }
var ErrMethodDepricated = fmt.Errorf("RPC_METHOD_DEPRECATED") // -32, //!< RPC method is deprecated
var ErrMethodNotFound = fmt.Errorf("RPC_METHOD_NOT_FOUND") // -32601,
RPC_METHOD_NOT_FOUND is internally mapped to HTTP_NOT_FOUND (404). It should not be used for application-layer errors.
var ErrMiscError = fmt.Errorf("RPC_MISC_ERROR") // -1, //!< std::exception thrown in command handling
! General application defined errors
var ErrOutOfMemory = fmt.Errorf("RPC_OUT_OF_MEMORY") // -7, //!< Ran out of memory during operation
var ErrParseError = fmt.Errorf("RPC_PARSE_ERROR") // -32700,
var ErrTypeError = fmt.Errorf("RPC_TYPE_ERROR") // -3, //!< Unexpected type was passed as parameter
var ErrVerifyAlreadyInChain = fmt.Errorf("RPC_VERIFY_ALREADY_IN_CHAIN") // -27, //!< Transaction already in chain
var ErrVerifyError = fmt.Errorf("RPC_VERIFY_ERROR") // -25, //!< General error during transaction or block submission
var ErrVerifyRejected = fmt.Errorf("RPC_VERIFY_REJECTED") // -26, //!< Transaction or block was rejected by network rules
var ErrWalletAlreadyUnlocked = fmt.Errorf("RPC_WALLET_ALREADY_UNLOCKED") // -17, //!< Wallet is already unlocked
var ErrWalletEncryptionFailed = fmt.Errorf("RPC_WALLET_ENCRYPTION_FAILED") // -16, //!< Failed to encrypt the wallet
var ErrWalletError = fmt.Errorf("RPC_WALLET_ERROR") // -4, //!< Unspecified problem with wallet (key not found etc.)
! Wallet errors
var ErrWalletInvalidLabelName = fmt.Errorf("RPC_WALLET_INVALID_LABEL_NAME") // -11, //!< Invalid label name
var ErrWalletKeypoolRanOut = fmt.Errorf("RPC_WALLET_KEYPOOL_RAN_OUT") // -12, //!< Keypool ran out, call keypoolrefill first
var ErrWalletNotFound = fmt.Errorf("RPC_WALLET_NOT_FOUND") // -18, //!< Invalid wallet specified
var ErrWalletNotSpecified = fmt.Errorf("RPC_WALLET_NOT_SPECIFIED") // -19, //!< No wallet specified (error when there are multiple wallets loaded)
var ErrWalletPassphraseIncorrect = fmt.Errorf("RPC_WALLET_PASSPHRASE_INCORRECT") // -14, //!< The wallet passphrase entered was incorrect
var ErrWalletUnlockNeeded = fmt.Errorf("RPC_WALLET_UNLOCK_NEEDED") // -13, //!< Enter the wallet passphrase with walletpassphrase first
var ErrWalletWrongEncState = fmt.Errorf("RPC_WALLET_WRONG_ENC_STATE") // -15, //!< Command given in wrong wallet encryption state (encrypting an encrypted wallet etc.)
Functions ¶
This section is empty.
Types ¶
type Bitcoind ¶
type Bitcoind struct {
// contains filtered or unexported fields
}
A Bitcoind represents a Bitcoind client
func (*Bitcoind) BackupWallet ¶
BackupWallet Safely copies wallet.dat to destination, which can be a directory or a path with filename on the remote server
func (*Bitcoind) CreateRawTransaction ¶
func (b *Bitcoind) CreateRawTransaction(inputs []*RawTransactionInput, output RawTransactionOutput) (rawtx string, err error)
CreateRawTransaction makes a new raw transaction from inputs and outputs
func (*Bitcoind) DecodeRawTransaction ¶
func (b *Bitcoind) DecodeRawTransaction(rawtx string) (decoded RawTransaction, err error)
func (*Bitcoind) DumpPrivKey ¶
DumpPrivKey return private key as string associated to public <address>
func (*Bitcoind) EncryptWallet ¶
EncryptWallet encrypts the wallet with <passphrase>.
func (*Bitcoind) EstimateFee ¶
EstimateFee gets the wallet estimate for a fee to confirm the transaction in the given number of blocks
func (*Bitcoind) FundRawTransaction ¶
func (b *Bitcoind) FundRawTransaction(rawtx string) (*FundRawTransactionResponse, error)
FundRawTransaction sends the provided signed raw transaction
func (*Bitcoind) GetAccount ¶
GetAccount returns the account associated with the given address.
func (*Bitcoind) GetAccountAddress ¶
GetAccountAddress Returns the current bitcoin address for receiving payments to this account. If account does not exist, it will be created along with an associated new address that will be returned.
func (*Bitcoind) GetAddressesByAccount ¶
GetAddressesByAccount return addresses associated with account <account>
func (*Bitcoind) GetBalance ¶
GetBalance return the balance of the server or of a specific account If [account] is "", returns the server's total available balance. If [account] is specified, returns the balance in the account
func (*Bitcoind) GetBestBlockhash ¶
GetBestBlockhash returns the hash of the best (tip) block in the longest block chain.
func (*Bitcoind) GetBlockCount ¶
GetBlockCount returns the number of blocks in the longest block chain.
func (*Bitcoind) GetBlockHash ¶
GetBlockHash returns hash of block in best-block-chain at <index>
func (*Bitcoind) GetBlockTemplate ¶
func (b *Bitcoind) GetBlockTemplate(capabilities []string, mode string) (template string, err error)
GetBlockTemplate Returns data needed to construct a block to work on. See BIP_0022 for more info on params.
func (*Bitcoind) GetConnectionCount ¶
GetConnectionCount returns the number of connections to other nodes.
func (*Bitcoind) GetDifficulty ¶
GetDifficulty returns the proof-of-work difficulty as a multiple of the minimum difficulty.
func (*Bitcoind) GetGenerate ¶
GetGenerate returns true or false whether bitcoind is currently generating hashes
func (*Bitcoind) GetHashesPerSec ¶
GetHashesPerSec returns a recent hashes per second performance measurement while generating.
func (*Bitcoind) GetMiningInfo ¶
func (b *Bitcoind) GetMiningInfo() (miningInfo MiningInfo, err error)
GetMiningInfo returns an object containing mining-related information
func (*Bitcoind) GetNewAddress ¶
GetNewAddress return a new address for account [account].
func (*Bitcoind) GetNewBech32Address ¶
GetNewBech32Address return a new bech32 address for account [account].
func (*Bitcoind) GetNewLegacyAddress ¶
GetNewLegacyAddress return a new legacy address for account [account].
func (*Bitcoind) GetNewP2SHAddress ¶ added in v0.2.1
GetNewP2SHAddress return a new address for account [account].
func (*Bitcoind) GetPeerInfo ¶
GetPeerInfo returns data about each connected node
func (*Bitcoind) GetRawChangeAddress ¶
GetRawChangeAddress Returns a new Bitcoin address, for receiving change. This is for use with raw transactions, NOT normal use.
func (*Bitcoind) GetRawMempool ¶
GetRawMempool returns all transaction ids in memory pool
func (*Bitcoind) GetRawTransaction ¶
GetRawTransaction returns raw transaction representation for given transaction id.
func (*Bitcoind) GetReceivedByAccount ¶
GetReceivedByAccount returns the total amount received by addresses with [account] in transactions with at least [minconf] confirmations. If [account] is set to all return will include all transactions to all accounts
func (*Bitcoind) GetReceivedByAddress ¶
GetReceivedByAddress returns the amount received by <address> in transactions with at least [minconf] confirmations. It correctly handles the case where someone has sent to the address in multiple transactions. Keep in mind that addresses are only ever used for receiving transactions. Works only for addresses in the local wallet, external addresses will always show 0.
func (*Bitcoind) GetTransaction ¶
func (b *Bitcoind) GetTransaction(txid string) (transaction Transaction, err error)
GetTransaction returns a Bitcoind.Transation struct about the given transaction
func (*Bitcoind) GetTxOut ¶
func (b *Bitcoind) GetTxOut(txid string, n uint32, includeMempool bool) (transactionOut UTransactionOut, err error)
GetTxOut returns details about an unspent transaction output (UTXO)
func (*Bitcoind) GetTxOutsetInfo ¶
func (b *Bitcoind) GetTxOutsetInfo() (txOutSet TransactionOutSet, err error)
GetTxOutsetInfo returns statistics about the unspent transaction output (UTXO) set
func (*Bitcoind) GetWalletInfo ¶ added in v0.2.2
func (b *Bitcoind) GetWalletInfo() (i WalletInfo, err error)
GetWalletInfo return result of "getinfo" command (Amazing !)
func (*Bitcoind) GetWork ¶
GetWork If [data] is not specified, returns formatted hash data to work on If [data] is specified, tries to solve the block and returns true if it was successful.
func (*Bitcoind) ImportPrivKey ¶
ImportPrivKey Adds a private key (as returned by dumpprivkey) to your wallet. This may take a while, as a rescan is done, looking for existing transactions. Optional [rescan] parameter added in 0.8.0. Note: There's no need to import public key, as in ECDSA (unlike RSA) this can be computed from private key.
func (*Bitcoind) KeyPoolRefill ¶
KeyPoolRefill fills the keypool, requires wallet passphrase to be set.
func (*Bitcoind) ListAccounts ¶
ListAccounts returns Object that has account names as keys, account balances as values.
func (*Bitcoind) ListAddressGroupings ¶
func (b *Bitcoind) ListAddressGroupings() (list []ListAddressResult, err error)
ListAddressGroupings returns all addresses in the wallet and info used for coincontrol.
func (*Bitcoind) ListLockUnspent ¶
func (b *Bitcoind) ListLockUnspent() (unspendableOutputs []UnspendableOutput, err error)
ListLockUnspent returns list of temporarily unspendable outputs
func (*Bitcoind) ListReceivedByAccount ¶
func (b *Bitcoind) ListReceivedByAccount(minConf uint32, includeEmpty bool) (list []ReceivedByAccount, err error)
ListReceivedByAccount Returns an slice of AccountRecieved:
func (*Bitcoind) ListReceivedByAddress ¶
func (b *Bitcoind) ListReceivedByAddress(minConf uint32, includeEmpty bool) (list []ReceivedByAddress, err error)
ListReceivedByAddress returns an slice of AccountRecieved:
func (*Bitcoind) ListSinceBlock ¶
func (b *Bitcoind) ListSinceBlock(blockHash string, targetConfirmations uint32) (transaction []Transaction, err error)
ListSinceBlock lists transactions since a blockhash
func (*Bitcoind) ListTransactions ¶
func (b *Bitcoind) ListTransactions(account string, count, from uint32) (transaction []Transaction, err error)
ListTransactions returns up to [count] most recent transactions skipping the first [from] transactions for account [account]. If [account] not provided it'll return recent transactions from all accounts.
func (*Bitcoind) ListUnspent ¶
func (b *Bitcoind) ListUnspent(minconf, maxconf int64) (transactions []UnspentOutput, err error)
ListUnspent returns array of unspent transaction inputs in the wallet.
func (*Bitcoind) LockUnspent ¶
func (b *Bitcoind) LockUnspent(lock bool, outputs []UnspendableOutput) (success bool, err error)
LockUnspent updates(lock/unlock) list of temporarily unspendable outputs
func (*Bitcoind) Move ¶
func (b *Bitcoind) Move(formAccount, toAccount string, amount float64, minconf uint32, comment string) (success bool, err error)
Move from one account in your wallet to another
func (*Bitcoind) SendFrom ¶
func (b *Bitcoind) SendFrom(fromAccount, toAddress string, amount float64, minconf uint32, comment, commentTo string) (txID string, err error)
SendFrom send amount from fromAccount to toAddress
amount is a real and is rounded to 8 decimal places. Will send the given amount to the given address, ensuring the account has a valid balance using [minconf] confirmations.
func (*Bitcoind) SendMany ¶
func (b *Bitcoind) SendMany(fromAccount string, amounts map[string]float64, minconf uint32, comment string) (txID string, err error)
SendMany send multiple times
func (*Bitcoind) SendRawTransaction ¶
SendRawTransaction sends the provided signed raw transaction
func (*Bitcoind) SendToAddress ¶
func (b *Bitcoind) SendToAddress(toAddress string, amount float64, comment, commentTo string) (txID string, err error)
SendToAddress send an amount to a given address
func (*Bitcoind) SetAccount ¶
SetAccount sets the account associated with the given address
func (*Bitcoind) SetGenerate ¶
SetGenerate turns generation on or off. Generation is limited to [genproclimit] processors, -1 is unlimited.
func (*Bitcoind) SignMessage ¶
SignMessage sign a message with the private key of an address
func (*Bitcoind) SignRawTransaction ¶
SignRawTransaction signs a proveded raw transaction
func (*Bitcoind) SignRawTransactionWithWallet ¶ added in v0.2.3
SignRawTransactionWithWallet signs a proveded raw transaction
func (*Bitcoind) ValidateAddress ¶
func (b *Bitcoind) ValidateAddress(address string) (va ValidateAddressResponse, err error)
ValidateAddress return information about <bitcoinaddress>.
func (*Bitcoind) VerifyMessage ¶
VerifyMessage verifies a signed message.
func (*Bitcoind) WalletLock ¶
WalletLock Removes the wallet encryption key from memory, locking the wallet. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked.
func (*Bitcoind) WalletPassphrase ¶
WalletPassphrase stores the wallet decryption key in memory for <timeout> seconds.
func (*Bitcoind) WalletPassphraseChange ¶
WalletPassphraseChange changes the wallet passphrase
type Block ¶
type Block struct {
// The block hash
Hash string `json:"hash"`
// The number of confirmations
Confirmations uint64 `json:"confirmations"`
// The block size
Size uint64 `json:"size"`
// The block height or index
Height uint64 `json:"height"`
// The block version
Version uint32 `json:"version"`
// The merkle root
Merkleroot string `json:"merkleroot"`
// Slice on transaction ids
Tx []string `json:"tx"`
// The block time in seconds since epoch (Jan 1 1970 GMT)
Time int64 `json:"time"`
// The nonce
Nonce uint64 `json:"nonce"`
// The bits
Bits string `json:"bits"`
// The difficulty
Difficulty float64 `json:"difficulty"`
// Total amount of work in active chain, in hexadecimal
Chainwork string `json:"chainwork,omitempty"`
// The hash of the previous block
Previousblockhash string `json:"previousblockhash"`
// The hash of the next block
Nextblockhash string `json:"nextblockhash"`
}
Represents a block
type Info ¶
type Info struct {
// The server version
Version uint32 `json:"version"`
// The protocol version
Protocolversion uint32 `json:"protocolversion"`
// The wallet version
Walletversion uint32 `json:"walletversion"`
// The total bitcoin balance of the wallet
Balance float64 `json:"balance"`
// The current number of blocks processed in the server
Blocks uint32 `json:"blocks"`
// The time offset
Timeoffset int32 `json:"timeoffset"`
// The number of connections
Connections uint32 `json:"connections"`
// Tthe proxy used by the server
Proxy string `json:"proxy,omitempty"`
// Tthe current difficulty
Difficulty float64 `json:"difficulty"`
// If the server is using testnet or not
Testnet bool `json:"testnet"`
// The timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool
Keypoololdest uint64 `json:"keypoololdest"`
// How many new keys are pre-generated
KeypoolSize uint32 `json:"keypoolsize,omitempty"`
// The timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked
UnlockedUntil int64 `json:"unlocked_until,omitempty"`
// the transaction fee set in btc/kb
Paytxfee float64 `json:"paytxfee"`
// Minimum relay fee for non-free transactions in btc/kb
Relayfee float64 `json:"relayfee"`
// Any error messages
Errors string `json:"errors"`
}
An Info represent a response to getmininginfo
type ListAddressResult ¶
ListAddressResult represents a result composing ListAddressGroupings slice reply
type MiningInfo ¶
type MiningInfo struct {
// The current block
Blocks uint64 `json:"blocks"`
// The last block size
CurrentBlocksize uint64 `json:"currentblocksize"`
// The last block transaction
CurrentBlockTx uint64 `json:"currentblocktx"`
// The current difficulty
Difficulty float64 `json:"difficulty"`
// Current errors
Errors string `json:"errors"`
// The processor limit for generation. -1 if no generation. (see getgenerate or setgenerate calls)
GenProcLimit int32 `json:"genproclimit"`
// The size of the mem pool
PooledtTx uint64 `json:"pooledtx"`
// If using testnet or not
Testnet bool `json:"testnet"`
// If the generation is on or off (see getgenerate or setgenerate calls)
Generate bool `json:"generate"`
// The network hashrate
NetworkHashps uint64 `json:"networkhashps"`
// Node hashrate
HashesPersec uint64 `json:"hashespersec"`
}
A MiningInfo represents a mininginfo response
type Peer ¶
type Peer struct {
// The ip address and port of the peer
Addr string `json:"addr"`
// Local address
Addrlocal string `json:"addrlocal"`
// The services
Services string `json:"services"`
// The time in seconds since epoch (Jan 1 1970 GMT) of the last send
Lastsend uint64 `json:"lastsend"`
// The time in seconds since epoch (Jan 1 1970 GMT) of the last receive
Lastrecv uint64 `json:"lastrecv"`
// The total bytes sent
Bytessent uint64 `json:"bytessent"`
// The total bytes received
Bytesrecv uint64 `json:"bytesrecv"`
// The connection time in seconds since epoch (Jan 1 1970 GMT)
Conntime uint64 `json:"conntime"`
// Ping time
Pingtime float64 `json:"pingtime"`
// Ping Wait
Pingwait float64 `json:"pingwait"`
// The peer version, such as 7001
Version uint32 `json:"version"`
// The string version
Subver string `json:"subver"`
// Inbound (true) or Outbound (false)
Inbound bool `json:"inbound"`
// The starting height (block) of the peer
Startingheight int32 `json:"startingheight"`
// The ban score (stats.nMisbehavior)
Banscore int32 `json:"banscore"`
// If sync node
Syncnode bool `json:"syncnode"`
}
type RawTransaction ¶
type RawTransaction struct {
Hex string `json:"hex"`
Txid string `json:"txid"`
Version uint32 `json:"version"`
LockTime uint32 `json:"locktime"`
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
BlockHash string `json:"blockhash,omitempty"`
Confirmations uint64 `json:"confirmations,omitempty"`
Time int64 `json:"time,omitempty"`
Blocktime int64 `json:"blocktime,omitempty"`
}
RawTx represents a raw transaction
type RawTransactionInput ¶
type RawTransactionOutput ¶
type ReceivedByAccount ¶
type ReceivedByAccount struct {
// the account of the receiving addresses
Account string
// total amount received by addresses with this account
Amount float64
// number of confirmations of the most recent transaction included
Confirmations uint32
}
ReceivedByAccount represents how much coin a account have recieved
type ReceivedByAddress ¶
type ReceivedByAddress struct {
// receiving address
Address string
// The corresponding account
Account string
// total amount received by addresses with this account
Amount float64
// number of confirmations of the most recent transaction included
Confirmations uint32
// Tansactions ID
TxIDs []string
}
ReceivedByAddress represents how much coin a account have recieved
type ScriptPubKey ¶
type SignRawTransactionError ¶
type SignRawTransactionError struct {
TxID string `json:"txid"`
Vout int `json:"vout"`
ScriptSig string `json:"scriptSig"`
Sequence int64 `json:"sequence"`
Message string `json:"error"`
}
func (*SignRawTransactionError) Error ¶
func (e *SignRawTransactionError) Error() string
type SignRawTransactionResponse ¶
type SignRawTransactionResponse struct {
Hex string `json:"hex"`
Complete bool `json:"complete"`
Errors []SignRawTransactionError `json:"errors,omitempty"`
}
func (*SignRawTransactionResponse) Error ¶
func (r *SignRawTransactionResponse) Error() string
func (*SignRawTransactionResponse) HasError ¶
func (r *SignRawTransactionResponse) HasError() bool
type Transaction ¶
type Transaction struct {
Amount float64 `json:"amount"`
Account string `json:"account,omitempty"`
Address string `json:"address,omitempty"`
Category TransactionCategory `json:"category,omitempty"`
Fee float64 `json:"fee,omitempty"`
Confirmations int64 `json:"confirmations"`
BlockHash string `json:"blockhash"`
BlockIndex int64 `json:"blockindex"`
BlockTime int64 `json:"blocktime"`
TxID string `json:"txid"`
Vout int64 `json:"vout,omitempty"`
WalletConflicts []string `json:"walletconflicts"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
Details []TransactionDetails `json:"details,omitempty"`
Hex string `json:"hex,omitempty"`
}
Transaction represents a transaction
type TransactionCategory ¶
type TransactionCategory string
TransactionCategory represents the category of a transaction
const ( TX_CATEGORY_SEND TransactionCategory = "send" TX_CATEGORY_RECEIVE TransactionCategory = "receive" )
type TransactionDetails ¶
type TransactionDetails struct {
Account string `json:"account"`
Address string `json:"address,omitempty"`
Category string `json:"category"`
Amount float64 `json:"amount"`
Fee float64 `json:"fee,omitempty"`
}
TransactionDetails represents details about a transaction
type TransactionOutSet ¶
type TransactionOutSet struct {
Height uint32 `json:"height"`
Bestblock string `json:"bestblock"`
Transactions float64 `json:"transactions"`
TxOuts float64 `json:"txouts"`
BytesSerialized float64 `json:"bytes_serialized"`
HashSerialized string `json:"hash_serialized"`
TotalAmount float64 `json:"total_amount"`
}
TransactionOutSet represents statistics about the unspent transaction output database
type UTransactionOut ¶
type UTransactionOut struct {
Bestblock string `json:"bestblock"`
Confirmations uint32 `json:"confirmations"`
Value float64 `json:"value"`
ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
Version uint32 `json:"version"`
Coinbase bool `json:"coinbase"`
}
UTransactionOut represents a unspent transaction out (UTXO)
type UnspendableOutput ¶
UnspendableOutput represents a unspendable (locked) output
type UnspentOutput ¶
type UnspentOutput struct {
TxID string `json:"txid"`
Vout uint32 `json:"vout"`
Address string `json:"address"`
Account string `json:"account,omitempty"`
ScriptPubKey string `json:"scriptPubKey"`
Amount float64 `json:"amount"`
Confirmations int64 `json:"confirmations"`
Spendable bool `json:"spendable"`
Solvable bool `json:"solvable"`
}
UnspentOutput represents the result from a call to `listunspent`
type ValidateAddressResponse ¶
type ValidateAddressResponse struct {
IsValid bool `json:"isvalid"`
Address string `json:"address"`
IsMine bool `json:"ismine"`
IsScript bool `json:"isscript"`
PubKey string `json:"pubkey"`
IsCompressed bool `json:"iscompressed"`
Account string `json:"account"`
}
ValidateAddressResponse represents a response to "validateaddress" call
type Vin ¶
type Vin struct {
Coinbase string `json:"coinbase"`
Txid string `json:"txid"`
Vout int `json:"vout"`
ScriptSig ScriptSig `json:"scriptSig"`
Sequence uint32 `json:"sequence"`
}
Vin represent an IN value
type Vout ¶
type Vout struct {
Value float64 `json:"value"`
N int `json:"n"`
ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
}
Vout represent an OUT value
type WalletInfo ¶ added in v0.2.2
type WalletInfo struct {
Name string `json:"walletname"`
Version int64 `json:"walletversion"`
Balance float64 `json:"balance"`
UnconfirmedBalance float64 `json:"unconfirmed_balance"`
ImmatureBalance float64 `json:"immature_balance"`
TxCount int64 `json:"txcount"`
KeypoolOldest int64 `json:"keypoololdest"`
KeypoolSize int64 `json:"keypoolsize"`
KeypoolSizeHDInternal int64 `json:"keypoolsize_hd_internal"`
UnlockedUntil int64 `json:"unlocked_until"`
PayTxFee float64 `json:"paytxfee"`
HDMasterKeyID string `json:"hdmasterkeyid"`
// Any error messages
Errors string `json:"errors"`
}
WalletInfo represents a response to getwalletinfo
