Documentation
¶
Index ¶
- Variables
- func DevSubsidyAddress(params *chaincfg.Params) (string, error)
- func ExtractBlockTransactions(msgBlock *wire.MsgBlock, txTree int8, chainParams *chaincfg.Params) ([]*Tx, [][]*Vout, []VinTxPropertyARRAY)
- type AddrTxnType
- type AddressRow
- type Block
- type BlockDataBasic
- type JSONB
- type ScriptPubKeyData
- type ScriptSig
- type SyncResult
- type TicketPoolStatus
- type TicketSpendType
- type Tx
- type UInt64Array
- type Vin
- type VinTxProperty
- type VinTxPropertyARRAY
- type Vout
Constants ¶
This section is empty.
Variables ¶
var AddrTxnTypes = map[AddrTxnType]string{ AddrTxnAll: "all", AddrTxnCredit: "credit", AddrTxnDebit: "debit", AddrTxnUnknown: "unknown", }
AddrTxnTypes is the canonical mapping from AddrTxnType to string.
Functions ¶
func DevSubsidyAddress ¶ added in v1.3.0
DevSubsidyAddress returns the development subsidy address for the specified network.
func ExtractBlockTransactions ¶
func ExtractBlockTransactions(msgBlock *wire.MsgBlock, txTree int8, chainParams *chaincfg.Params) ([]*Tx, [][]*Vout, []VinTxPropertyARRAY)
ExtractBlockTransactions extracts transaction information from a wire.MsgBlock and returns the processed information in slices of the dbtypes Tx, Vout, and VinTxPropertyARRAY.
Types ¶
type AddrTxnType ¶
type AddrTxnType int
AddrTxnType enumerates the different transaction types as displayed by the address page.
const ( AddrTxnAll AddrTxnType = iota AddrTxnCredit AddrTxnDebit AddrTxnUnknown )
func AddrTxnTypeFromStr ¶
func AddrTxnTypeFromStr(txnType string) AddrTxnType
AddrTxnTypeFromStr attempts to decode a string into an AddrTxnType.
func (AddrTxnType) String ¶
func (a AddrTxnType) String() string
type AddressRow ¶
type AddressRow struct {
// id int64
Address string
FundingTxDbID uint64
FundingTxHash string
FundingTxVoutIndex uint32
VoutDbID uint64
Value uint64
SpendingTxDbID uint64
SpendingTxHash string
SpendingTxVinIndex uint32
VinDbID uint64
}
AddressRow represents a row in the addresses table
type Block ¶
type Block struct {
Hash string `json:"hash"`
Size uint32 `json:"size"`
Height uint32 `json:"height"`
Version uint32 `json:"version"`
MerkleRoot string `json:"merkleroot"`
StakeRoot string `json:"stakeroot"`
NumTx uint32
NumRegTx uint32
Tx []string `json:"tx"`
TxDbIDs []uint64
NumStakeTx uint32
STx []string `json:"stx"`
STxDbIDs []uint64
Time uint64 `json:"time"`
Nonce uint64 `json:"nonce"`
VoteBits uint16 `json:"votebits"`
FinalState []byte `json:"finalstate"`
Voters uint16 `json:"voters"`
FreshStake uint8 `json:"freshstake"`
Revocations uint8 `json:"revocations"`
PoolSize uint32 `json:"poolsize"`
Bits uint32 `json:"bits"`
SBits uint64 `json:"sbits"`
Difficulty float64 `json:"difficulty"`
ExtraData []byte `json:"extradata"`
StakeVersion uint32 `json:"stakeversion"`
PreviousHash string `json:"previousblockhash"`
}
Block models a Decred block.
type BlockDataBasic ¶
type BlockDataBasic struct {
Height uint32 `json:"height,omitemtpy"`
Size uint32 `json:"size,omitemtpy"`
Hash string `json:"hash,omitemtpy"`
Difficulty float64 `json:"diff,omitemtpy"`
StakeDiff float64 `json:"sdiff,omitemtpy"`
Time int64 `json:"time,omitemtpy"`
NumTx uint32 `json:"txlength,omitempty"`
}
type JSONB ¶
type JSONB map[string]interface{}
JSONB is used to implement the sql.Scanner and driver.Valuer interfaces required for the type to make a postgresql compatible JSONB type.
type ScriptPubKeyData ¶
type ScriptPubKeyData struct {
ReqSigs uint32 `json:"reqSigs"`
Type string `json:"type"`
Addresses []string `json:"addresses"`
}
ScriptPubKeyData is part of the result of decodescript(ScriptPubKeyHex)
type ScriptSig ¶
ScriptSig models the signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)
type SyncResult ¶
SyncResult is the result of a database sync operation, containing the height of the last block and an arror value.
type TicketPoolStatus ¶
type TicketPoolStatus int16
const ( PoolStatusLive TicketPoolStatus = iota PoolStatusVoted PoolStatusExpired PoolStatusMissed )
func (TicketPoolStatus) String ¶
func (p TicketPoolStatus) String() string
type TicketSpendType ¶
type TicketSpendType int16
const ( TicketUnspent TicketSpendType = iota TicketRevoked TicketVoted )
func (TicketSpendType) String ¶
func (p TicketSpendType) String() string
type Tx ¶
type Tx struct {
//blockDbID int64
BlockHash string `json:"block_hash"`
BlockHeight int64 `json:"block_height"`
BlockTime int64 `json:"block_time"`
Time int64 `json:"time"`
TxType int16 `json:"tx_type"`
Version uint16 `json:"version"`
Tree int8 `json:"tree"`
TxID string `json:"txid"`
BlockIndex uint32 `json:"block_index"`
Locktime uint32 `json:"locktime"`
Expiry uint32 `json:"expiry"`
Size uint32 `json:"size"`
Spent int64 `json:"spent"`
Sent int64 `json:"sent"`
Fees int64 `json:"fees"`
NumVin uint32 `json:"numvin"`
//Vins VinTxPropertyARRAY `json:"vins"`
VinDbIds []uint64 `json:"vindbids"`
NumVout uint32 `json:"numvout"`
Vouts []*Vout `json:"vouts"`
VoutDbIds []uint64 `json:"voutdbids"`
}
Tx models a Decred transaction. It is stored in a Block.
type UInt64Array ¶
type UInt64Array []uint64
UInt64Array represents a one-dimensional array of PostgreSQL integer types
func (*UInt64Array) Scan ¶
func (a *UInt64Array) Scan(src interface{}) error
Scan implements the sql.Scanner interface.
type Vin ¶
type Vin struct {
//txDbID int64
Coinbase string `json:"coinbase"`
TxHash string `json:"txhash"`
VoutIdx uint32 `json:"voutidx"`
Tree int8 `json:"tree"`
Sequence uint32 `json:"sequence"`
AmountIn float64 `json:"amountin"`
BlockHeight uint32 `json:"blockheight"`
BlockIndex uint32 `json:"blockindex"`
ScriptHex string `json:"scripthex"`
}
Vin models a transaction input.
type VinTxProperty ¶
type VinTxProperty struct {
PrevOut string `json:"prevout"`
PrevTxHash string `json:"prevtxhash"`
PrevTxIndex uint32 `json:"prevvoutidx"`
PrevTxTree uint16 `json:"tree"`
Sequence uint32 `json:"sequence"`
ValueIn uint64 `json:"amountin"`
TxID string `json:"tx_hash"`
TxIndex uint32 `json:"tx_index"`
TxTree uint16 `json:"tx_tree"`
BlockHeight uint32 `json:"blockheight"`
BlockIndex uint32 `json:"blockindex"`
ScriptHex []byte `json:"scripthex"`
}
VinTxProperty models a transaction input with previous outpoint information.
type VinTxPropertyARRAY ¶
type VinTxPropertyARRAY []VinTxProperty
VinTxPropertyARRAY is a slice of VinTxProperty sturcts that implements sql.Scanner and driver.Valuer.
func (*VinTxPropertyARRAY) Scan ¶
func (p *VinTxPropertyARRAY) Scan(src interface{}) error
Scan satisfies sql.Scanner
type Vout ¶
type Vout struct {
// txDbID int64
TxHash string `json:"tx_hash"`
TxIndex uint32 `json:"tx_index"`
TxTree int8 `json:"tx_tree"`
Value uint64 `json:"value"`
Version uint16 `json:"version"`
ScriptPubKey []byte `json:"pkScriptHex"`
ScriptPubKeyData ScriptPubKeyData `json:"pkScript"`
}
Vout defines a transaction output