Documentation
¶
Index ¶
- Variables
- func UnmarshalFixedJSON(typ reflect.Type, input, out []byte) error
- func UnmarshalFixedText(typname string, input, out []byte) error
- func UnmarshalFixedUnprefixedText(typname string, input, out []byte) error
- type BlockVerboseResult
- type GetBanlistResult
- type GetBlockHeaderVerboseResult
- type GetBlockTemplateResult
- type GetBlockTemplateResultAux
- type GetBlockTemplateResultPt
- type GetBlockTemplateResultTx
- type GetGraphStateResult
- type GetPeerInfoResult
- type GetRawTransactionsResult
- type GetUtxoResult
- type InfoNodeResult
- type KV
- type OrderedResult
- type PowDiff
- type PowDiffReference
- type PowResult
- type PrevOut
- type ProofData
- type Result
- type ScriptPubKeyResult
- type ScriptSig
- type TemplateRequest
- type TxRawResult
- type Vin
- type VinPrevOut
- type Vout
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyString = &decError{"empty hex string"} ErrSyntax = &decError{"invalid hex string"} ErrMissingPrefix = &decError{"hex string without 0x prefix"} ErrOddLength = &decError{"hex string of odd length"} ErrEmptyNumber = &decError{"hex string \"0x\""} ErrLeadingZero = &decError{"hex number with leading zero digits"} ErrUint64Range = &decError{"hex number > 64 bits"} ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} ErrBig256Range = &decError{"hex number > 256 bits"} )
Errors
Functions ¶
func UnmarshalFixedJSON ¶
UnmarshalFixedJSON decodes the input as a string with 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalJSON method for fixed-size types.
func UnmarshalFixedText ¶
UnmarshalFixedText decodes the input as a string. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
func UnmarshalFixedUnprefixedText ¶
UnmarshalFixedUnprefixedText decodes the input as a string with optional 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
Types ¶
type BlockVerboseResult ¶
type BlockVerboseResult struct {
Hash string `json:"hash"`
Confirmations int64 `json:"confirmations"`
Size int32 `json:"size"`
Height int64 `json:"height"`
Version int32 `json:"version"`
TxRoot string `json:"txRoot"`
Tx []string `json:"tx,omitempty"`
RawTx []TxRawResult `json:"rawtx,omitempty"`
Time int64 `json:"time"`
PowResult PowResult `json:"pow"`
Difficulty uint32 `json:"difficulty"`
PreviousHash string `json:"previousblockhash"`
NextHash string `json:"nextblockhash,omitempty"`
}
type GetBanlistResult ¶
type GetBlockHeaderVerboseResult ¶
type GetBlockHeaderVerboseResult struct {
Hash string `json:"hash"`
Confirmations int64 `json:"confirmations"`
Version int32 `json:"version"`
ParentRoot string `json:"parentroot"`
TxRoot string `json:"txRoot"`
StateRoot string `json:"stateRoot"`
Difficulty uint32 `json:"difficulty"`
Layer uint32 `json:"layer"`
Time int64 `json:"time"`
PowResult PowResult `json:"pow"`
}
GetBlockHeaderVerboseResult models the data from the getblockheader command when the verbose flag is set. When the verbose flag is not set, getblockheader returns a hex-encoded string.
type GetBlockTemplateResult ¶
type GetBlockTemplateResult struct {
// Base fields from BIP 0022. CoinbaseAux is optional. One of
// CoinbaseTxn or CoinbaseValue must be specified, but not both.
StateRoot string `json:"stateroot"`
CurTime int64 `json:"curtime"`
Height int64 `json:"height"`
Blues int64 `json:"blues"`
PreviousHash string `json:"previousblockhash"`
SigOpLimit int64 `json:"sigoplimit,omitempty"`
SizeLimit int64 `json:"sizelimit,omitempty"`
WeightLimit int64 `json:"weightlimit,omitempty"`
Parents []GetBlockTemplateResultPt `json:"parents"`
Transactions []GetBlockTemplateResultTx `json:"transactions"`
Version uint32 `json:"version"`
CoinbaseAux *GetBlockTemplateResultAux `json:"coinbaseaux,omitempty"`
CoinbaseTxn *GetBlockTemplateResultTx `json:"coinbasetxn,omitempty"`
CoinbaseValue *uint64 `json:"coinbasevalue,omitempty"`
WorkID string `json:"workid,omitempty"`
// Witness commitment defined in BIP 0141.
DefaultWitnessCommitment string `json:"default_witness_commitment,omitempty"`
// Optional long polling from BIP 0022.
LongPollID string `json:"longpollid,omitempty"`
LongPollURI string `json:"longpolluri,omitempty"`
SubmitOld *bool `json:"submitold,omitempty"`
// Basic pool extension from BIP 0023.
Expires int64 `json:"expires,omitempty"`
PowDiffReference PowDiffReference `json:"pow_diff_reference"`
// Mutations from BIP 0023.
MaxTime int64 `json:"maxtime,omitempty"`
MinTime int64 `json:"mintime,omitempty"`
Mutable []string `json:"mutable,omitempty"`
NonceRange string `json:"noncerange,omitempty"`
// Block proposal from BIP 0023.
Capabilities []string `json:"capabilities,omitempty"`
RejectReasion string `json:"reject-reason,omitempty"`
}
GetBlockTemplateResult models the data returned from the getblocktemplate
type GetBlockTemplateResultAux ¶
type GetBlockTemplateResultAux struct {
Flags string `json:"flags"`
}
GetBlockTemplateResultAux models the coinbaseaux field of the getblocktemplate command.
type GetBlockTemplateResultPt ¶
GetBlockTemplateResultPt models the parents field of the getblocktemplate command.
type GetBlockTemplateResultTx ¶
type GetBlockTemplateResultTx struct {
Data string `json:"data"`
Hash string `json:"hash"`
Depends []int64 `json:"depends"`
Fee int64 `json:"fee"`
SigOps int64 `json:"sigops"`
Weight int64 `json:"weight"`
}
GetBlockTemplateResultTx models the transactions field of the getblocktemplate command.
type GetGraphStateResult ¶
type GetGraphStateResult struct {
Tips []string `json:"tips"`
MainOrder uint32 `json:"mainorder"`
MainHeight uint32 `json:"mainheight"`
Layer uint32 `json:"layer"`
}
GetGraphStateResult data
type GetPeerInfoResult ¶
type GetPeerInfoResult struct {
UUID string `json:"uuid"`
ID int32 `json:"id"`
Addr string `json:"addr"`
AddrLocal string `json:"addrlocal,omitempty"`
Services string `json:"services"`
RelayTxes bool `json:"relaytxes"`
LastSend int64 `json:"lastsend"`
LastRecv int64 `json:"lastrecv"`
BytesSent uint64 `json:"bytessent"`
BytesRecv uint64 `json:"bytesrecv"`
ConnTime int64 `json:"conntime"`
TimeOffset int64 `json:"timeoffset"`
PingTime float64 `json:"pingtime"`
PingWait float64 `json:"pingwait,omitempty"`
Version uint32 `json:"version"`
SubVer string `json:"subver"`
Inbound bool `json:"inbound"`
BanScore int32 `json:"banscore"`
SyncNode bool `json:"syncnode"`
GraphState GetGraphStateResult `json:"graphstate"`
}
GetPeerInfoResult models the data returned from the getpeerinfo command.
type GetRawTransactionsResult ¶
type GetRawTransactionsResult struct {
Hex string `json:"hex,omitempty"`
Txid string `json:"txid"`
Hash string `json:"hash"`
Size string `json:"size"`
Vsize string `json:"vsize"`
Version uint32 `json:"version"`
LockTime uint32 `json:"locktime"`
Vin []VinPrevOut `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"`
}
GetRawTransactionsResult models the data from the getrawtransactions command.
type GetUtxoResult ¶
type GetUtxoResult struct {
BestBlock string `json:"bestblock"`
Confirmations int64 `json:"confirmations"`
Amount float64 `json:"amount"`
ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
Version int32 `json:"version"`
Coinbase bool `json:"coinbase"`
}
GetUtxoResult models the data from the GetUtxo command.
type InfoNodeResult ¶
type InfoNodeResult struct {
UUID string `json:"UUID"`
Version int32 `json:"version"`
BuildVersion string `json:"buildversion"`
ProtocolVersion int32 `json:"protocolversion"`
TotalSubsidy uint64 `json:"totalsubsidy"`
GraphState GetGraphStateResult `json:"graphstate"`
TimeOffset int64 `json:"timeoffset"`
Connections int32 `json:"connections"`
PowDiff PowDiff `json:"pow_diff"`
TestNet bool `json:"testnet"`
MixNet bool `json:"mixnet"`
Confirmations int32 `json:"confirmations"`
CoinbaseMaturity int32 `json:"coinbasematurity"`
Errors string `json:"errors"`
Modules []string `json:"modules"`
}
InfoNodeResult models the data returned by the node server getnodeinfo command.
type OrderedResult ¶
type OrderedResult []KV
The OrderedResult works as the order map[string]interface{}, which useful to marshal a Json map using a specific order Note: it works almost as the 'omitEmpty' set to true, empty value should be omitted when marshaling. only for empty string/array/map/slice/interface
func (*OrderedResult) GetValue ¶
func (ores *OrderedResult) GetValue(key string) interface{}
func (OrderedResult) MarshalJSON ¶
func (ores OrderedResult) MarshalJSON() ([]byte, error)
type PowDiff ¶
type PowDiff struct {
Blake2bdDiff float64 `json:"blake2bd_diff"`
CuckarooDiff float64 `json:"cuckaroo_diff"`
CuckatooDiff float64 `json:"cuckatoo_diff"`
}
for pow diff
type PowDiffReference ¶
type PowDiffReference struct {
//blake2bd diff
Blake2bDBits string `json:"blake2bd_bits"`
//blake2bd hash diff compare target
Blake2bTarget string `json:"blake2bd_target"`
X16rv3Bits string `json:"x_16_rv_3_bits"`
X16rv3Target string `json:"x_16_rv_3_target"`
X8r16Bits string `json:"x8r16_bits"`
X8r16Target string `json:"x8r16_target"`
BitcoinpayKeccak256Bits string `json:"bitcoinpay_keccak256_bits"`
BitcoinpayKeccak256Target string `json:"bitcoinpay_keccak256_target"`
//cuckoo mining min diff
CuckarooMinDiff uint64 `json:"cuckaroo_min_diff,omitempty"`
CuckaroomMinDiff uint64 `json:"cuckaroom_min_diff,omitempty"`
CuckatooMinDiff uint64 `json:"cuckatoo_min_diff,omitempty"`
}
for miner template
type PowResult ¶
type PowResult struct {
PowName string `json:"pow_name"`
PowType uint8 `json:"pow_type"`
Nonce uint32 `json:"nonce"`
ProofData *ProofData `json:"proof_data,omitempty"`
}
pow json result
type Result ¶
type Result map[string]interface{}
The Result works as method calling response can be marshaled as json map
type ScriptPubKeyResult ¶
type ScriptPubKeyResult struct {
Asm string `json:"asm"`
Hex string `json:"hex,omitempty"`
ReqSigs int32 `json:"reqSigs,omitempty"`
Type string `json:"type"`
Addresses []string `json:"addresses,omitempty"`
}
ScriptPubKeyResult models the scriptPubKey data of a tx script. It is defined separately since it is used by multiple commands.
type ScriptSig ¶
ScriptSig models a signature script. It is defined separately since it only applies to non-coinbase. Therefore the field in the Vin structure needs to be a pointer.
type TemplateRequest ¶
type TemplateRequest struct {
Mode string `json:"mode,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
// Optional long polling.
LongPollID string `json:"longpollid,omitempty"`
// Optional template tweaking. SigOpLimit and SizeLimit can be int64
// or bool.
SigOpLimit interface{} `json:"sigoplimit,omitempty"`
SizeLimit interface{} `json:"sizelimit,omitempty"`
MaxVersion uint32 `json:"maxversion,omitempty"`
// Basic pool extension from BIP 0023.
Target string `json:"target,omitempty"`
// Block proposal from BIP 0023. Data is only provided when Mode is
// "proposal".
Data string `json:"data,omitempty"`
WorkID string `json:"workid,omitempty"`
}
LL(getblocktemplate RPC) 2018-10-28 TemplateRequest is a request object as defined in BIP22 (https://en.bitcoin.it/wiki/BIP_0022), it is optionally provided as an // argument to GetBlockTemplate RPC.
type TxRawResult ¶
type TxRawResult struct {
Hex string `json:"hex"`
Txid string `json:"txid"`
TxHash string `json:"txhash,omitempty"`
Size int32 `json:"size,omitempty"`
Version uint32 `json:"version"`
LockTime uint32 `json:"locktime"`
Timestamp string `json:"timestamp,omitempty"`
Expire uint32 `json:"expire"`
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
BlockHash string `json:"blockhash,omitempty"`
BlockOrder uint64 `json:"blockorder,omitempty"`
TxIndex uint32 `json:"txindex,omitempty"`
Confirmations int64 `json:"confirmations"`
Time int64 `json:"time,omitempty"`
Blocktime int64 `json:"blocktime,omitempty"`
Duplicate bool `json:"duplicate,omitempty"`
Txsvalid bool `json:"txsvalid"`
}
TxRawResult models the data from the getrawtransaction command.
type Vin ¶
type Vin struct {
Coinbase string `json:"coinbase"`
Txid string `json:"txid"`
Vout uint32 `json:"vout"`
Sequence uint32 `json:"sequence"`
ScriptSig *ScriptSig `json:"scriptSig"`
}
Vin models parts of the tx data. It is defined separately since getrawtransaction, decoderawtransaction, and searchrawtransaction use the same structure.
func (*Vin) IsCoinBase ¶
IsCoinBase returns a bool to show if a Vin is a Coinbase one or not.
func (*Vin) MarshalJSON ¶
MarshalJSON provides a custom Marshal method for Vin.
type VinPrevOut ¶
type Vout ¶
type Vout struct {
Amount uint64 `json:"amount"`
ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
}
Vout models parts of the tx data. It is defined separately since both getrawtransaction and decoderawtransaction use the same structure.