Documentation ¶
Overview ¶
Package bchain is a generated protocol buffer package.
It is generated from these files:
tx.proto
It has these top-level messages:
ProtoTransaction
Index ¶
- Constants
- Variables
- func AmountToDecimalString(a *big.Int, d int) string
- func ReceivedSatFromBalances(balance *big.Int, sent *big.Int) *big.Int
- type AddrBalance
- type AddrDescForOutpointFunc
- type AddressBalanceDetail
- type AddressDescriptor
- type AddressesMap
- type Amount
- type Asset
- type AssetAllocation
- type AssetBalance
- type AssetInfo
- type Assets
- type AssetsMap
- type AssetsMask
- type AuxFeeDetails
- type BaseChain
- func (b *BaseChain) EthereumTypeEstimateGas(params map[string]interface{}) (uint64, error)
- func (b *BaseChain) EthereumTypeGetBalance(addrDesc AddressDescriptor) (*big.Int, error)
- func (b *BaseChain) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc AddressDescriptor) (*big.Int, error)
- func (b *BaseChain) EthereumTypeGetErc20ContractInfo(contractDesc AddressDescriptor) (*Erc20Contract, error)
- func (b *BaseChain) EthereumTypeGetNonce(addrDesc AddressDescriptor) (uint64, error)
- func (b *BaseChain) GetChainParser() BlockChainParser
- func (b *BaseChain) GetChainTips() (string, error)
- func (b *BaseChain) GetMempoolEntry(txid string) (*MempoolEntry, error)
- func (b *BaseChain) GetNetworkName() string
- func (b *BaseChain) IsTestnet() bool
- type BaseMempool
- func (m *BaseMempool) GetAddrDescTransactions(addrDesc AddressDescriptor) ([]Outpoint, error)
- func (m *BaseMempool) GetAllEntries() MempoolTxidEntries
- func (m *BaseMempool) GetTransactionTime(txid string) uint32
- func (m *BaseMempool) GetTransactions(address string) ([]Outpoint, error)
- func (m *BaseMempool) GetTxAssets(assetGuid uint32) MempoolTxidEntries
- type BaseParser
- func (p *BaseParser) AmountDecimals() int
- func (p *BaseParser) AmountToBigInt(n common.JSONNumber) (big.Int, error)
- func (p *BaseParser) AmountToDecimalString(a *big.Int) string
- func (p *BaseParser) AppendAssetInfo(assetInfo *AssetInfo, buf []byte, varBuf []byte) []byte
- func (p *BaseParser) AppendTxInput(txi *TxInput, buf []byte, varBuf []byte) []byte
- func (p *BaseParser) AppendTxOutput(txo *TxOutput, buf []byte, varBuf []byte) []byte
- func (p *BaseParser) DerivationBasePath(xpub string) (string, error)
- func (p *BaseParser) DeriveAddressDescriptors(xpub string, change uint32, indexes []uint32) ([]AddressDescriptor, error)
- func (p *BaseParser) DeriveAddressDescriptorsFromTo(xpub string, change uint32, fromIndex uint32, toIndex uint32) ([]AddressDescriptor, error)
- func (p *BaseParser) EthereumTypeGetErc20FromTx(tx *Tx) ([]Erc20Transfer, error)
- func (p *BaseParser) GetAddrDescForUnknownInput(tx *Tx, input int) AddressDescriptor
- func (p *BaseParser) GetAllocationFromTx(tx *Tx) (*AssetAllocation, error)
- func (p *BaseParser) GetAssetAllocationFromData(sptData []byte) (*AssetAllocation, error)
- func (p *BaseParser) GetAssetAllocationFromDesc(addrDesc *AddressDescriptor) (*AssetAllocation, error)
- func (p *BaseParser) GetAssetFromData(sptData []byte) (*Asset, error)
- func (p *BaseParser) GetAssetFromDesc(addrDesc *AddressDescriptor) (*Asset, error)
- func (p *BaseParser) GetAssetTypeFromVersion(nVersion int32) *TokenType
- func (p *BaseParser) GetAssetsMaskFromVersion(nVersion int32) AssetsMask
- func (p *BaseParser) GetChainType() ChainType
- func (p *BaseParser) GetMaxAddrLength() int
- func (p *BaseParser) IsAddrDescIndexable(addrDesc AddressDescriptor) bool
- func (p *BaseParser) IsAssetActivateTx(nVersion int32) bool
- func (p *BaseParser) IsAssetAllocationTx(nVersion int32) bool
- func (p *BaseParser) IsAssetSendTx(nVersion int32) bool
- func (p *BaseParser) IsAssetTx(nVersion int32) bool
- func (p *BaseParser) IsSyscoinMintTx(nVersion int32) bool
- func (p *BaseParser) IsSyscoinTx(nVersion int32) bool
- func (p *BaseParser) KeepBlockAddresses() int
- func (p *BaseParser) LoadAssets(tx *Tx) error
- func (p *BaseParser) MaxPackedBigintBytes() int
- func (p *BaseParser) MinimumCoinbaseConfirmations() int
- func (p *BaseParser) PackAddrBalance(ab *AddrBalance, buf, varBuf []byte) []byte
- func (p *BaseParser) PackAddressKey(addrDesc AddressDescriptor, height uint32) []byte
- func (p *BaseParser) PackAsset(asset *Asset) ([]byte, error)
- func (p *BaseParser) PackAssetKey(assetGuid uint32, height uint32) []byte
- func (p *BaseParser) PackAssetTxIndex(txAsset *TxAsset) []byte
- func (p *BaseParser) PackBigint(bi *big.Int, buf []byte) int
- func (p *BaseParser) PackBlockHash(hash string) ([]byte, error)
- func (p *BaseParser) PackBlockInfo(block *DbBlockInfo) ([]byte, error)
- func (p *BaseParser) PackOutpoints(outpoints []DbOutpoint) []byte
- func (p *BaseParser) PackTx(tx *Tx, height uint32, blockTime int64) ([]byte, error)
- func (p *BaseParser) PackTxAddresses(ta *TxAddresses, buf []byte, varBuf []byte) []byte
- func (p *BaseParser) PackTxIndexes(txi []TxIndexes) []byte
- func (p *BaseParser) PackTxid(txid string) ([]byte, error)
- func (p *BaseParser) PackUint(i uint32) []byte
- func (p *BaseParser) PackVarBytes(bufValue []byte, buf []byte, varBuf []byte) []byte
- func (p *BaseParser) PackVarint(i int, buf []byte) int
- func (p *BaseParser) PackVarint32(i int32, buf []byte) int
- func (p *BaseParser) PackVaruint(i uint, buf []byte) int
- func (p *BaseParser) PackedTxIndexLen() int
- func (p *BaseParser) PackedTxidLen() int
- func (p *BaseParser) ParseBlock(b []byte) (*Block, error)
- func (p *BaseParser) ParseTx(b []byte) (*Tx, error)
- func (p *BaseParser) ParseTxFromJson(msg json.RawMessage) (*Tx, error)
- func (p *BaseParser) TryGetOPReturn(script []byte) []byte
- func (p *BaseParser) UnpackAddrBalance(buf []byte, txidUnpackedLen int, detail AddressBalanceDetail) (*AddrBalance, error)
- func (p *BaseParser) UnpackAddressKey(key []byte) ([]byte, uint32, error)
- func (p *BaseParser) UnpackAsset(buf []byte) (*Asset, error)
- func (p *BaseParser) UnpackAssetInfo(assetInfo *AssetInfo, buf []byte) int
- func (p *BaseParser) UnpackAssetKey(buf []byte) (uint32, uint32)
- func (p *BaseParser) UnpackAssetTxIndex(buf []byte) []*TxAssetIndex
- func (p *BaseParser) UnpackBigint(buf []byte) (big.Int, int)
- func (p *BaseParser) UnpackBlockHash(buf []byte) (string, error)
- func (p *BaseParser) UnpackBlockInfo(buf []byte) (*DbBlockInfo, error)
- func (p *BaseParser) UnpackNOutpoints(buf []byte) ([]DbOutpoint, int, error)
- func (p *BaseParser) UnpackTx(buf []byte) (*Tx, uint32, error)
- func (p *BaseParser) UnpackTxAddresses(buf []byte) (*TxAddresses, error)
- func (p *BaseParser) UnpackTxIndexType(buf []byte) (AssetsMask, int)
- func (p *BaseParser) UnpackTxIndexes(txindexes *[]int32, buf *[]byte) error
- func (p *BaseParser) UnpackTxInput(ti *TxInput, buf []byte) int
- func (p *BaseParser) UnpackTxOutput(to *TxOutput, buf []byte) int
- func (p *BaseParser) UnpackTxid(buf []byte) (string, error)
- func (p *BaseParser) UnpackUint(buf []byte) uint32
- func (p *BaseParser) UnpackVarBytes(buf []byte) ([]byte, int)
- func (p *BaseParser) UnpackVarint(buf []byte) (int, int)
- func (p *BaseParser) UnpackVarint32(buf []byte) (int32, int)
- func (p *BaseParser) UnpackVaruint(buf []byte) (uint, int)
- func (p *BaseParser) WitnessPubKeyHashFromKeyID(keyId []byte) (string, error)
- type Block
- type BlockChain
- type BlockChainParser
- type BlockHeader
- type BlockInfo
- type BlockTxs
- type ChainInfo
- type ChainType
- type DbBlockInfo
- type DbOutpoint
- type Erc20Contract
- type Erc20Transfer
- type MQ
- type Mempool
- type MempoolBitcoinType
- type MempoolEntry
- type MempoolEthereumType
- type MempoolTx
- type MempoolTxidEntries
- type MempoolTxidEntry
- type MempoolVin
- type NotaryDetails
- type NotificationType
- type OnNewBlockFunc
- type OnNewTxAddrFunc
- type OnNewTxFunc
- type Outpoint
- type ProtoTransaction
- func (*ProtoTransaction) Descriptor() ([]byte, []int)
- func (m *ProtoTransaction) GetBlocktime() uint64
- func (m *ProtoTransaction) GetHeight() uint32
- func (m *ProtoTransaction) GetHex() []byte
- func (m *ProtoTransaction) GetLocktime() uint32
- func (m *ProtoTransaction) GetTxid() []byte
- func (m *ProtoTransaction) GetVersion() int32
- func (m *ProtoTransaction) GetVin() []*ProtoTransaction_VinType
- func (m *ProtoTransaction) GetVout() []*ProtoTransaction_VoutType
- func (*ProtoTransaction) ProtoMessage()
- func (m *ProtoTransaction) Reset()
- func (m *ProtoTransaction) String() string
- type ProtoTransaction_VinType
- func (*ProtoTransaction_VinType) Descriptor() ([]byte, []int)
- func (m *ProtoTransaction_VinType) GetAddresses() []string
- func (m *ProtoTransaction_VinType) GetCoinbase() string
- func (m *ProtoTransaction_VinType) GetScriptSigHex() []byte
- func (m *ProtoTransaction_VinType) GetSequence() uint32
- func (m *ProtoTransaction_VinType) GetTxid() []byte
- func (m *ProtoTransaction_VinType) GetVout() uint32
- func (*ProtoTransaction_VinType) ProtoMessage()
- func (m *ProtoTransaction_VinType) Reset()
- func (m *ProtoTransaction_VinType) String() string
- type ProtoTransaction_VoutType
- func (*ProtoTransaction_VoutType) Descriptor() ([]byte, []int)
- func (m *ProtoTransaction_VoutType) GetAddresses() []string
- func (m *ProtoTransaction_VoutType) GetN() uint32
- func (m *ProtoTransaction_VoutType) GetScriptPubKeyHex() []byte
- func (m *ProtoTransaction_VoutType) GetValueSat() []byte
- func (*ProtoTransaction_VoutType) ProtoMessage()
- func (m *ProtoTransaction_VoutType) Reset()
- func (m *ProtoTransaction_VoutType) String() string
- type RPCError
- type ScriptPubKey
- type ScriptSig
- type Token
- type TokenTransferSummary
- type TokenType
- type Tokens
- type Tx
- type TxAddresses
- type TxAsset
- type TxAssetAddress
- type TxAssetAddressIndex
- type TxAssetAddressMap
- type TxAssetIndex
- type TxAssetMap
- type TxIndexes
- type TxInput
- type TxOutput
- type Utxo
- type Vin
- type Vout
Constants ¶
const ( // ChainBitcoinType is blockchain derived from bitcoin ChainBitcoinType = ChainType(iota) // ChainEthereumType is blockchain derived from ethereum ChainEthereumType )
const ( // AddressBalanceDetailNoUTXO returns address balance without utxos AddressBalanceDetailNoUTXO = 0 // AddressBalanceDetailUTXO returns address balance with utxos AddressBalanceDetailUTXO = 1 // AddressBalanceDetailUTXOIndexed returns address balance with utxos and index for updates, used only internally AddressBalanceDetailUTXOIndexed = 2 )
const PackedHeightBytes = 4
Variables ¶
var ( // ErrBlockNotFound is returned when block is not found // either unknown hash or too high height // can be returned from GetBlockHash, GetBlockHeader, GetBlock ErrBlockNotFound = errors.New("Block not found") // ErrAddressMissing is returned if address is not specified // for example To address in ethereum can be missing in case of contract transaction ErrAddressMissing = errors.New("Address missing") // ErrTxidMissing is returned if txid is not specified // for example coinbase transactions in Bitcoin ErrTxidMissing = errors.New("Txid missing") // ErrTxNotFound is returned if transaction was not found ErrTxNotFound = errors.New("Tx not found") )
errors with specific meaning returned by blockchain rpc
Functions ¶
func AmountToDecimalString ¶ added in v0.2.0
AmountToDecimalString converts amount in big.Int to string with decimal point in the place defined by the parameter d
Types ¶
type AddrBalance ¶ added in v0.3.4
type AddrBalance struct { Txs uint32 SentSat big.Int BalanceSat big.Int Utxos []Utxo UtxosMap map[string]int AssetBalances map[uint32]*AssetBalance }
AddrBalance stores number of transactions and balances of an address
func (*AddrBalance) AddUtxoInDisconnect ¶ added in v0.3.4
func (ab *AddrBalance) AddUtxoInDisconnect(u *Utxo)
on disconnect, the added utxos must be inserted in the right position so that UtxosMap index works
func (*AddrBalance) MarkUtxoAsSpent ¶ added in v0.3.4
func (ab *AddrBalance) MarkUtxoAsSpent(btxID []byte, vout int32)
MarkUtxoAsSpent finds outpoint btxID:vout in utxos and marks it as spent for small number of utxos the linear search is done, for larger number there is a hashmap index it is much faster than removing the utxo from the slice as it would cause in memory reallocations
func (*AddrBalance) ReceivedSat ¶ added in v0.3.4
func (ab *AddrBalance) ReceivedSat() *big.Int
ReceivedSat computes received amount from total balance and sent amount
type AddrDescForOutpointFunc ¶ added in v0.2.2
type AddrDescForOutpointFunc func(outpoint Outpoint) (AddressDescriptor, *big.Int)
AddrDescForOutpointFunc returns address descriptor and value for given outpoint or nil if outpoint not found
type AddressBalanceDetail ¶ added in v0.3.4
type AddressBalanceDetail int
AddressBalanceDetail specifies what data are returned by GetAddressBalance
type AddressDescriptor ¶ added in v0.1.0
type AddressDescriptor []byte
AddressDescriptor is an opaque type obtained by parser.GetAddrDesc* methods
func AddressDescriptorFromString ¶ added in v0.3.4
func AddressDescriptorFromString(s string) (AddressDescriptor, error)
AddressDescriptorFromString converts string created by AddressDescriptor.String to AddressDescriptor
func (AddressDescriptor) String ¶ added in v0.1.0
func (ad AddressDescriptor) String() string
type AddressesMap ¶ added in v0.3.4
AddressesMap is a map of addresses in a block each address contains a slice of transactions with indexes where the address appears slice is used instead of map so that order is defined and also search in case of few items
type Amount ¶ added in v0.3.4
Amount is datatype holding amounts
func (*Amount) AsBigInt ¶ added in v0.3.4
AsBigInt returns big.Int type for the Amount (empty if Amount is nil)
func (*Amount) AsInt64 ¶ added in v0.3.4
AsInt64 returns Amount as int64 (0 if Amount is nil). It is used only for legacy interfaces (socket.io) and generally not recommended to use for possible loss of precision.
func (*Amount) DecimalString ¶ added in v0.3.4
DecimalString returns amount with decimal point placed according to parameter d
func (*Amount) MarshalJSON ¶ added in v0.3.4
MarshalJSON Amount serialization
type AssetAllocation ¶ added in v0.3.5
type AssetAllocation struct {
AssetObj wire.AssetAllocationType
}
encapuslates Syscoin SPT wire types
type AssetBalance ¶ added in v0.3.4
holds balance information for an asset indexed by a uint32 asset guid
type AssetsMask ¶ added in v0.3.4
type AssetsMask uint32
const AllMask AssetsMask = 0
const AssetActivateMask AssetsMask = 256
const AssetAllocationBurnToEthereumMask AssetsMask = 16
const AssetAllocationBurnToSyscoinMask AssetsMask = 8
const AssetAllocationMintMask AssetsMask = 32
const AssetAllocationSendMask AssetsMask = 2
const AssetSendMask AssetsMask = 128
const AssetSyscoinBurnToAllocationMask AssetsMask = 4
const AssetUpdateMask AssetsMask = 64
const BaseCoinMask AssetsMask = 1
type AuxFeeDetails ¶ added in v0.3.5
type AuxFeeDetails = wire.AuxFeeDetailsType
type BaseChain ¶ added in v0.2.0
type BaseChain struct { Parser BlockChainParser Testnet bool Network string }
BaseChain is base type for bchain.BlockChain
func (*BaseChain) EthereumTypeEstimateGas ¶ added in v0.2.0
EthereumTypeEstimateGas is not supported
func (*BaseChain) EthereumTypeGetBalance ¶ added in v0.2.0
func (b *BaseChain) EthereumTypeGetBalance(addrDesc AddressDescriptor) (*big.Int, error)
EthereumTypeGetBalance is not supported
func (*BaseChain) EthereumTypeGetErc20ContractBalance ¶ added in v0.2.0
func (b *BaseChain) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc AddressDescriptor) (*big.Int, error)
EthereumTypeGetErc20ContractBalance is not supported
func (*BaseChain) EthereumTypeGetErc20ContractInfo ¶ added in v0.2.0
func (b *BaseChain) EthereumTypeGetErc20ContractInfo(contractDesc AddressDescriptor) (*Erc20Contract, error)
EthereumTypeGetErc20ContractInfo is not supported
func (*BaseChain) EthereumTypeGetNonce ¶ added in v0.2.0
func (b *BaseChain) EthereumTypeGetNonce(addrDesc AddressDescriptor) (uint64, error)
EthereumTypeGetNonce is not supported
func (*BaseChain) GetChainParser ¶ added in v0.2.0
func (b *BaseChain) GetChainParser() BlockChainParser
GetChainParser returns BlockChainParser
func (*BaseChain) GetChainTips ¶ added in v0.3.4
func (*BaseChain) GetMempoolEntry ¶ added in v0.2.2
func (b *BaseChain) GetMempoolEntry(txid string) (*MempoolEntry, error)
GetMempoolEntry is not supported by default
func (*BaseChain) GetNetworkName ¶ added in v0.2.0
GetNetworkName returns network name
type BaseMempool ¶ added in v0.2.2
type BaseMempool struct { OnNewTxAddr OnNewTxAddrFunc OnNewTx OnNewTxFunc // contains filtered or unexported fields }
BaseMempool is mempool base handle
func (*BaseMempool) GetAddrDescTransactions ¶ added in v0.2.2
func (m *BaseMempool) GetAddrDescTransactions(addrDesc AddressDescriptor) ([]Outpoint, error)
GetAddrDescTransactions returns slice of mempool transactions for given address descriptor, in reverse order
func (*BaseMempool) GetAllEntries ¶ added in v0.2.2
func (m *BaseMempool) GetAllEntries() MempoolTxidEntries
GetAllEntries returns all mempool entries sorted by fist seen time in descending order
func (*BaseMempool) GetTransactionTime ¶ added in v0.2.2
func (m *BaseMempool) GetTransactionTime(txid string) uint32
GetTransactionTime returns first seen time of a transaction
func (*BaseMempool) GetTransactions ¶ added in v0.2.2
func (m *BaseMempool) GetTransactions(address string) ([]Outpoint, error)
GetTransactions returns slice of mempool transactions for given address
func (*BaseMempool) GetTxAssets ¶ added in v0.3.5
func (m *BaseMempool) GetTxAssets(assetGuid uint32) MempoolTxidEntries
type BaseParser ¶
BaseParser implements data parsing/handling functionality base for all other parsers
func (*BaseParser) AmountDecimals ¶ added in v0.2.0
func (p *BaseParser) AmountDecimals() int
AmountDecimals returns number of decimal places in amounts
func (*BaseParser) AmountToBigInt ¶ added in v0.1.0
func (p *BaseParser) AmountToBigInt(n common.JSONNumber) (big.Int, error)
AmountToBigInt converts amount in common.JSONNumber (string) to big.Int it uses string operations to avoid problems with rounding
func (*BaseParser) AmountToDecimalString ¶ added in v0.1.0
func (p *BaseParser) AmountToDecimalString(a *big.Int) string
AmountToDecimalString converts amount in big.Int to string with decimal point in the correct place
func (*BaseParser) AppendAssetInfo ¶ added in v0.3.5
func (p *BaseParser) AppendAssetInfo(assetInfo *AssetInfo, buf []byte, varBuf []byte) []byte
func (*BaseParser) AppendTxInput ¶ added in v0.3.4
func (p *BaseParser) AppendTxInput(txi *TxInput, buf []byte, varBuf []byte) []byte
func (*BaseParser) AppendTxOutput ¶ added in v0.3.4
func (p *BaseParser) AppendTxOutput(txo *TxOutput, buf []byte, varBuf []byte) []byte
func (*BaseParser) DerivationBasePath ¶ added in v0.2.1
func (p *BaseParser) DerivationBasePath(xpub string) (string, error)
DerivationBasePath is unsupported
func (*BaseParser) DeriveAddressDescriptors ¶ added in v0.2.1
func (p *BaseParser) DeriveAddressDescriptors(xpub string, change uint32, indexes []uint32) ([]AddressDescriptor, error)
DeriveAddressDescriptors is unsupported
func (*BaseParser) DeriveAddressDescriptorsFromTo ¶ added in v0.2.1
func (p *BaseParser) DeriveAddressDescriptorsFromTo(xpub string, change uint32, fromIndex uint32, toIndex uint32) ([]AddressDescriptor, error)
DeriveAddressDescriptorsFromTo is unsupported
func (*BaseParser) EthereumTypeGetErc20FromTx ¶ added in v0.2.0
func (p *BaseParser) EthereumTypeGetErc20FromTx(tx *Tx) ([]Erc20Transfer, error)
EthereumTypeGetErc20FromTx is unsupported
func (*BaseParser) GetAddrDescForUnknownInput ¶ added in v0.2.0
func (p *BaseParser) GetAddrDescForUnknownInput(tx *Tx, input int) AddressDescriptor
GetAddrDescForUnknownInput returns nil AddressDescriptor
func (*BaseParser) GetAllocationFromTx ¶ added in v0.3.5
func (p *BaseParser) GetAllocationFromTx(tx *Tx) (*AssetAllocation, error)
func (*BaseParser) GetAssetAllocationFromData ¶ added in v0.3.5
func (p *BaseParser) GetAssetAllocationFromData(sptData []byte) (*AssetAllocation, error)
func (*BaseParser) GetAssetAllocationFromDesc ¶ added in v0.3.5
func (p *BaseParser) GetAssetAllocationFromDesc(addrDesc *AddressDescriptor) (*AssetAllocation, error)
func (*BaseParser) GetAssetFromData ¶ added in v0.3.5
func (p *BaseParser) GetAssetFromData(sptData []byte) (*Asset, error)
func (*BaseParser) GetAssetFromDesc ¶ added in v0.3.5
func (p *BaseParser) GetAssetFromDesc(addrDesc *AddressDescriptor) (*Asset, error)
func (*BaseParser) GetAssetTypeFromVersion ¶ added in v0.3.4
func (p *BaseParser) GetAssetTypeFromVersion(nVersion int32) *TokenType
func (*BaseParser) GetAssetsMaskFromVersion ¶ added in v0.3.4
func (p *BaseParser) GetAssetsMaskFromVersion(nVersion int32) AssetsMask
func (*BaseParser) GetChainType ¶ added in v0.2.0
func (p *BaseParser) GetChainType() ChainType
GetChainType is type of the blockchain, default is ChainBitcoinType
func (*BaseParser) GetMaxAddrLength ¶ added in v0.3.4
func (p *BaseParser) GetMaxAddrLength() int
func (*BaseParser) IsAddrDescIndexable ¶ added in v0.3.0
func (p *BaseParser) IsAddrDescIndexable(addrDesc AddressDescriptor) bool
IsAddrDescIndexable returns true if AddressDescriptor should be added to index by default all AddressDescriptors are indexable
func (*BaseParser) IsAssetActivateTx ¶ added in v0.3.4
func (p *BaseParser) IsAssetActivateTx(nVersion int32) bool
func (*BaseParser) IsAssetAllocationTx ¶ added in v0.3.4
func (p *BaseParser) IsAssetAllocationTx(nVersion int32) bool
func (*BaseParser) IsAssetSendTx ¶ added in v0.3.4
func (p *BaseParser) IsAssetSendTx(nVersion int32) bool
func (*BaseParser) IsAssetTx ¶ added in v0.3.4
func (p *BaseParser) IsAssetTx(nVersion int32) bool
func (*BaseParser) IsSyscoinMintTx ¶ added in v0.3.4
func (p *BaseParser) IsSyscoinMintTx(nVersion int32) bool
func (*BaseParser) IsSyscoinTx ¶ added in v0.3.4
func (p *BaseParser) IsSyscoinTx(nVersion int32) bool
func (*BaseParser) KeepBlockAddresses ¶
func (p *BaseParser) KeepBlockAddresses() int
KeepBlockAddresses returns number of blocks which are to be kept in blockaddresses column
func (*BaseParser) LoadAssets ¶ added in v0.3.5
func (p *BaseParser) LoadAssets(tx *Tx) error
func (*BaseParser) MaxPackedBigintBytes ¶ added in v0.3.4
func (p *BaseParser) MaxPackedBigintBytes() int
func (*BaseParser) MinimumCoinbaseConfirmations ¶ added in v0.3.4
func (p *BaseParser) MinimumCoinbaseConfirmations() int
MinimumCoinbaseConfirmations returns minimum number of confirmations a coinbase transaction must have before it can be spent
func (*BaseParser) PackAddrBalance ¶ added in v0.3.4
func (p *BaseParser) PackAddrBalance(ab *AddrBalance, buf, varBuf []byte) []byte
func (*BaseParser) PackAddressKey ¶ added in v0.3.4
func (p *BaseParser) PackAddressKey(addrDesc AddressDescriptor, height uint32) []byte
func (*BaseParser) PackAsset ¶ added in v0.3.4
func (p *BaseParser) PackAsset(asset *Asset) ([]byte, error)
func (*BaseParser) PackAssetKey ¶ added in v0.3.4
func (p *BaseParser) PackAssetKey(assetGuid uint32, height uint32) []byte
func (*BaseParser) PackAssetTxIndex ¶ added in v0.3.4
func (p *BaseParser) PackAssetTxIndex(txAsset *TxAsset) []byte
func (*BaseParser) PackBigint ¶ added in v0.3.4
func (p *BaseParser) PackBigint(bi *big.Int, buf []byte) int
big int is packed in BigEndian order without memory allocation as 1 byte length followed by bytes of big int number of written bytes is returned limitation: bigints longer than 248 bytes are truncated to 248 bytes caution: buffer must be big enough to hold the packed big int, buffer 249 bytes big is always safe
func (*BaseParser) PackBlockHash ¶
func (p *BaseParser) PackBlockHash(hash string) ([]byte, error)
PackBlockHash packs block hash to byte array
func (*BaseParser) PackBlockInfo ¶ added in v0.3.4
func (p *BaseParser) PackBlockInfo(block *DbBlockInfo) ([]byte, error)
func (*BaseParser) PackOutpoints ¶ added in v0.3.4
func (p *BaseParser) PackOutpoints(outpoints []DbOutpoint) []byte
func (*BaseParser) PackTxAddresses ¶ added in v0.3.4
func (p *BaseParser) PackTxAddresses(ta *TxAddresses, buf []byte, varBuf []byte) []byte
func (*BaseParser) PackTxIndexes ¶ added in v0.3.4
func (p *BaseParser) PackTxIndexes(txi []TxIndexes) []byte
func (*BaseParser) PackTxid ¶
func (p *BaseParser) PackTxid(txid string) ([]byte, error)
PackTxid packs txid to byte array
func (*BaseParser) PackUint ¶ added in v0.3.4
func (p *BaseParser) PackUint(i uint32) []byte
func (*BaseParser) PackVarBytes ¶ added in v0.3.5
func (p *BaseParser) PackVarBytes(bufValue []byte, buf []byte, varBuf []byte) []byte
func (*BaseParser) PackVarint ¶ added in v0.3.4
func (p *BaseParser) PackVarint(i int, buf []byte) int
func (*BaseParser) PackVarint32 ¶ added in v0.3.4
func (p *BaseParser) PackVarint32(i int32, buf []byte) int
func (*BaseParser) PackVaruint ¶ added in v0.3.4
func (p *BaseParser) PackVaruint(i uint, buf []byte) int
func (*BaseParser) PackedTxIndexLen ¶ added in v0.3.5
func (p *BaseParser) PackedTxIndexLen() int
func (*BaseParser) PackedTxidLen ¶
func (p *BaseParser) PackedTxidLen() int
PackedTxidLen returns length in bytes of packed txid
func (*BaseParser) ParseBlock ¶
func (p *BaseParser) ParseBlock(b []byte) (*Block, error)
ParseBlock parses raw block to our Block struct - currently not implemented
func (*BaseParser) ParseTx ¶
func (p *BaseParser) ParseTx(b []byte) (*Tx, error)
ParseTx parses byte array containing transaction and returns Tx struct - currently not implemented
func (*BaseParser) ParseTxFromJson ¶
func (p *BaseParser) ParseTxFromJson(msg json.RawMessage) (*Tx, error)
ParseTxFromJson parses JSON message containing transaction and returns Tx struct
func (*BaseParser) TryGetOPReturn ¶ added in v0.3.4
func (p *BaseParser) TryGetOPReturn(script []byte) []byte
func (*BaseParser) UnpackAddrBalance ¶ added in v0.3.4
func (p *BaseParser) UnpackAddrBalance(buf []byte, txidUnpackedLen int, detail AddressBalanceDetail) (*AddrBalance, error)
func (*BaseParser) UnpackAddressKey ¶ added in v0.3.4
func (p *BaseParser) UnpackAddressKey(key []byte) ([]byte, uint32, error)
func (*BaseParser) UnpackAsset ¶ added in v0.3.4
func (p *BaseParser) UnpackAsset(buf []byte) (*Asset, error)
func (*BaseParser) UnpackAssetInfo ¶ added in v0.3.5
func (p *BaseParser) UnpackAssetInfo(assetInfo *AssetInfo, buf []byte) int
func (*BaseParser) UnpackAssetKey ¶ added in v0.3.4
func (p *BaseParser) UnpackAssetKey(buf []byte) (uint32, uint32)
func (*BaseParser) UnpackAssetTxIndex ¶ added in v0.3.4
func (p *BaseParser) UnpackAssetTxIndex(buf []byte) []*TxAssetIndex
func (*BaseParser) UnpackBigint ¶ added in v0.3.4
func (p *BaseParser) UnpackBigint(buf []byte) (big.Int, int)
func (*BaseParser) UnpackBlockHash ¶
func (p *BaseParser) UnpackBlockHash(buf []byte) (string, error)
UnpackBlockHash unpacks byte array to block hash
func (*BaseParser) UnpackBlockInfo ¶ added in v0.3.4
func (p *BaseParser) UnpackBlockInfo(buf []byte) (*DbBlockInfo, error)
func (*BaseParser) UnpackNOutpoints ¶ added in v0.3.4
func (p *BaseParser) UnpackNOutpoints(buf []byte) ([]DbOutpoint, int, error)
func (*BaseParser) UnpackTx ¶
func (p *BaseParser) UnpackTx(buf []byte) (*Tx, uint32, error)
UnpackTx unpacks transaction from protobuf byte array
func (*BaseParser) UnpackTxAddresses ¶ added in v0.3.4
func (p *BaseParser) UnpackTxAddresses(buf []byte) (*TxAddresses, error)
func (*BaseParser) UnpackTxIndexType ¶ added in v0.3.5
func (p *BaseParser) UnpackTxIndexType(buf []byte) (AssetsMask, int)
func (*BaseParser) UnpackTxIndexes ¶ added in v0.3.4
func (p *BaseParser) UnpackTxIndexes(txindexes *[]int32, buf *[]byte) error
func (*BaseParser) UnpackTxInput ¶ added in v0.3.4
func (p *BaseParser) UnpackTxInput(ti *TxInput, buf []byte) int
func (*BaseParser) UnpackTxOutput ¶ added in v0.3.4
func (p *BaseParser) UnpackTxOutput(to *TxOutput, buf []byte) int
func (*BaseParser) UnpackTxid ¶
func (p *BaseParser) UnpackTxid(buf []byte) (string, error)
UnpackTxid unpacks byte array to txid
func (*BaseParser) UnpackUint ¶ added in v0.3.4
func (p *BaseParser) UnpackUint(buf []byte) uint32
func (*BaseParser) UnpackVarBytes ¶ added in v0.3.5
func (p *BaseParser) UnpackVarBytes(buf []byte) ([]byte, int)
func (*BaseParser) UnpackVarint ¶ added in v0.3.4
func (p *BaseParser) UnpackVarint(buf []byte) (int, int)
func (*BaseParser) UnpackVarint32 ¶ added in v0.3.4
func (p *BaseParser) UnpackVarint32(buf []byte) (int32, int)
func (*BaseParser) UnpackVaruint ¶ added in v0.3.4
func (p *BaseParser) UnpackVaruint(buf []byte) (uint, int)
func (*BaseParser) WitnessPubKeyHashFromKeyID ¶ added in v0.3.5
func (p *BaseParser) WitnessPubKeyHashFromKeyID(keyId []byte) (string, error)
type Block ¶
type Block struct { BlockHeader Txs []Tx `json:"tx"` }
Block is block header and list of transactions
type BlockChain ¶
type BlockChain interface { // life-cycle methods // initialize the block chain connector Initialize() error // create mempool but do not initialize it CreateMempool(BlockChain) (Mempool, error) // initialize mempool, create ZeroMQ (or other) subscription InitializeMempool(AddrDescForOutpointFunc, OnNewTxAddrFunc, OnNewTxFunc) error // shutdown mempool, ZeroMQ and block chain connections Shutdown(ctx context.Context) error // chain info IsTestnet() bool GetNetworkName() string GetSubversion() string GetCoinName() string GetChainInfo() (*ChainInfo, error) // requests GetBestBlockHash() (string, error) GetBestBlockHeight() (uint32, error) GetBlockHash(height uint32) (string, error) GetBlockHeader(hash string) (*BlockHeader, error) GetBlock(hash string, height uint32) (*Block, error) GetBlockInfo(hash string) (*BlockInfo, error) GetMempoolTransactions() ([]string, error) GetTransaction(txid string) (*Tx, error) GetTransactionForMempool(txid string) (*Tx, error) GetTransactionSpecific(tx *Tx) (json.RawMessage, error) EstimateSmartFee(blocks int, conservative bool) (big.Int, error) EstimateFee(blocks int) (big.Int, error) SendRawTransaction(tx string) (string, error) GetMempoolEntry(txid string) (*MempoolEntry, error) // parser GetChainParser() BlockChainParser // EthereumType specific EthereumTypeGetBalance(addrDesc AddressDescriptor) (*big.Int, error) EthereumTypeGetNonce(addrDesc AddressDescriptor) (uint64, error) EthereumTypeEstimateGas(params map[string]interface{}) (uint64, error) EthereumTypeGetErc20ContractInfo(contractDesc AddressDescriptor) (*Erc20Contract, error) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc AddressDescriptor) (*big.Int, error) GetChainTips() (string, error) }
BlockChain defines common interface to block chain daemon
type BlockChainParser ¶
type BlockChainParser interface { // type of the blockchain GetChainType() ChainType // KeepBlockAddresses returns number of blocks which are to be kept in blockTxs column // to be used for rollbacks KeepBlockAddresses() int // AmountDecimals returns number of decimal places in coin amounts AmountDecimals() int // MinimumCoinbaseConfirmations returns minimum number of confirmations a coinbase transaction must have before it can be spent MinimumCoinbaseConfirmations() int // AmountToDecimalString converts amount in big.Int to string with decimal point in the correct place AmountToDecimalString(a *big.Int) string // AmountToBigInt converts amount in common.JSONNumber (string) to big.Int // it uses string operations to avoid problems with rounding AmountToBigInt(n common.JSONNumber) (big.Int, error) // get max script length, in bitcoin base derivatives its 1024 // but for example in syscoin this is going to be 8000 for max opreturn output script for syscoin coloured tx GetMaxAddrLength() int // address descriptor conversions GetAddrDescFromVout(output *Vout) (AddressDescriptor, error) GetAddrDescFromAddress(address string) (AddressDescriptor, error) GetAddressesFromAddrDesc(addrDesc AddressDescriptor) ([]string, bool, error) GetScriptFromAddrDesc(addrDesc AddressDescriptor) ([]byte, error) IsAddrDescIndexable(addrDesc AddressDescriptor) bool // parsing/packing/unpacking specific to chain PackedTxidLen() int PackedTxIndexLen() int PackTxid(txid string) ([]byte, error) UnpackTxid(buf []byte) (string, error) ParseTx(b []byte) (*Tx, error) ParseTxFromJson(json.RawMessage) (*Tx, error) PackTx(tx *Tx, height uint32, blockTime int64) ([]byte, error) UnpackTx(buf []byte) (*Tx, uint32, error) GetAddrDescForUnknownInput(tx *Tx, input int) AddressDescriptor PackAddrBalance(ab *AddrBalance, buf, varBuf []byte) []byte UnpackAddrBalance(buf []byte, txidUnpackedLen int, detail AddressBalanceDetail) (*AddrBalance, error) PackAddressKey(addrDesc AddressDescriptor, height uint32) []byte UnpackAddressKey(key []byte) ([]byte, uint32, error) PackTxAddresses(ta *TxAddresses, buf []byte, varBuf []byte) []byte AppendTxInput(txi *TxInput, buf []byte, varBuf []byte) []byte AppendTxOutput(txo *TxOutput, buf []byte, varBuf []byte) []byte UnpackTxAddresses(buf []byte) (*TxAddresses, error) UnpackTxInput(ti *TxInput, buf []byte) int UnpackTxOutput(to *TxOutput, buf []byte) int PackTxIndexes(txi []TxIndexes) []byte UnpackTxIndexes(txindexes *[]int32, buf *[]byte) error PackOutpoints(outpoints []DbOutpoint) []byte UnpackNOutpoints(buf []byte) ([]DbOutpoint, int, error) PackBlockInfo(block *DbBlockInfo) ([]byte, error) UnpackBlockInfo(buf []byte) (*DbBlockInfo, error) // packing/unpacking generic to all chain (expect this to be in baseparser) PackUint(i uint32) []byte UnpackUint(buf []byte) uint32 PackVarint32(i int32, buf []byte) int PackVarint(i int, buf []byte) int PackVaruint(i uint, buf []byte) int UnpackVarint32(buf []byte) (int32, int) UnpackVarint(buf []byte) (int, int) UnpackVaruint(buf []byte) (uint, int) PackBigint(bi *big.Int, buf []byte) int UnpackBigint(buf []byte) (big.Int, int) MaxPackedBigintBytes() int UnpackVarBytes(buf []byte) ([]byte, int) PackVarBytes(bufValue []byte, buf []byte, varBuf []byte) []byte // blocks PackBlockHash(hash string) ([]byte, error) UnpackBlockHash(buf []byte) (string, error) ParseBlock(b []byte) (*Block, error) // xpub DerivationBasePath(xpub string) (string, error) DeriveAddressDescriptors(xpub string, change uint32, indexes []uint32) ([]AddressDescriptor, error) DeriveAddressDescriptorsFromTo(xpub string, change uint32, fromIndex uint32, toIndex uint32) ([]AddressDescriptor, error) // EthereumType specific EthereumTypeGetErc20FromTx(tx *Tx) ([]Erc20Transfer, error) // SyscoinType specific IsSyscoinTx(nVersion int32) bool IsSyscoinMintTx(nVersion int32) bool IsAssetTx(nVersion int32) bool IsAssetAllocationTx(nVersion int32) bool IsAssetActivateTx(nVersion int32) bool IsAssetSendTx(nVersion int32) bool TryGetOPReturn(script []byte) []byte GetAssetsMaskFromVersion(nVersion int32) AssetsMask GetAssetTypeFromVersion(nVersion int32) *TokenType PackAssetKey(assetGuid uint32, height uint32) []byte UnpackAssetKey(key []byte) (uint32, uint32) PackAssetTxIndex(txAsset *TxAsset) []byte UnpackAssetTxIndex(buf []byte) []*TxAssetIndex PackAsset(asset *Asset) ([]byte, error) UnpackAsset(buf []byte) (*Asset, error) GetAssetFromData(sptData []byte) (*Asset, error) GetAssetAllocationFromData(sptData []byte) (*AssetAllocation, error) GetAssetFromDesc(addrDesc *AddressDescriptor) (*Asset, error) GetAssetAllocationFromDesc(addrDesc *AddressDescriptor) (*AssetAllocation, error) GetAllocationFromTx(tx *Tx) (*AssetAllocation, error) LoadAssets(tx *Tx) error AppendAssetInfo(assetInfo *AssetInfo, buf []byte, varBuf []byte) []byte UnpackAssetInfo(assetInfo *AssetInfo, buf []byte) int UnpackTxIndexType(buf []byte) (AssetsMask, int) WitnessPubKeyHashFromKeyID(keyId []byte) (string, error) }
BlockChainParser defines common interface to parsing and conversions of block chain data
type BlockHeader ¶
type BlockHeader struct { Hash string `json:"hash"` Prev string `json:"previousblockhash"` Next string `json:"nextblockhash"` Height uint32 `json:"height"` Confirmations int `json:"confirmations"` Size int `json:"size"` Time int64 `json:"time,omitempty"` }
BlockHeader contains limited data (as needed for indexing) from backend block header
type BlockInfo ¶ added in v0.1.0
type BlockInfo struct { BlockHeader Version common.JSONNumber `json:"version"` MerkleRoot string `json:"merkleroot"` Nonce common.JSONNumber `json:"nonce"` Bits string `json:"bits"` Difficulty common.JSONNumber `json:"difficulty"` Txids []string `json:"tx,omitempty"` }
BlockInfo contains extended block header data and a list of block txids
type BlockTxs ¶ added in v0.3.4
type BlockTxs struct { BtxID []byte Inputs []DbOutpoint }
type ChainInfo ¶ added in v0.1.0
type ChainInfo struct { Chain string `json:"chain"` Blocks int `json:"blocks"` Headers int `json:"headers"` Bestblockhash string `json:"bestblockhash"` Difficulty string `json:"difficulty"` SizeOnDisk int64 `json:"size_on_disk"` Version string `json:"version"` Subversion string `json:"subversion"` ProtocolVersion string `json:"protocolversion"` Timeoffset float64 `json:"timeoffset"` Warnings string `json:"warnings"` }
ChainInfo is used to get information about blockchain
type DbBlockInfo ¶ added in v0.3.4
type DbBlockInfo struct { Hash string Time int64 Txs uint32 Size uint32 Height uint32 // Height is not packed! }
BlockInfo holds information about blocks kept in column height
type DbOutpoint ¶ added in v0.3.4
type Erc20Contract ¶ added in v0.2.0
type Erc20Contract struct { Contract string `json:"contract"` Name string `json:"name"` Symbol string `json:"symbol"` Decimals int `json:"decimals"` }
Erc20Contract contains info about ERC20 contract
type Erc20Transfer ¶ added in v0.2.0
Erc20Transfer contains a single ERC20 token transfer
type MQ ¶
type MQ struct {
// contains filtered or unexported fields
}
MQ is message queue listener handle
type Mempool ¶ added in v0.2.2
type Mempool interface { Resync() (int, error) GetTransactions(address string) ([]Outpoint, error) GetAddrDescTransactions(addrDesc AddressDescriptor) ([]Outpoint, error) GetAllEntries() MempoolTxidEntries GetTransactionTime(txid string) uint32 GetTxAssets(assetGuid uint32) MempoolTxidEntries }
Mempool defines common interface to mempool
type MempoolBitcoinType ¶ added in v0.2.0
type MempoolBitcoinType struct { BaseMempool AddrDescForOutpoint AddrDescForOutpointFunc // contains filtered or unexported fields }
MempoolBitcoinType is mempool handle.
func NewMempoolBitcoinType ¶ added in v0.2.0
func NewMempoolBitcoinType(chain BlockChain, workers int, subworkers int) *MempoolBitcoinType
NewMempoolBitcoinType creates new mempool handler. For now there is no cleanup of sync routines, the expectation is that the mempool is created only once per process
func (*MempoolBitcoinType) Resync ¶ added in v0.2.0
func (m *MempoolBitcoinType) Resync() (int, error)
Resync gets mempool transactions and maps outputs to transactions. Resync is not reentrant, it should be called from a single thread. Read operations (GetTransactions) are safe.
type MempoolEntry ¶
type MempoolEntry struct { Size uint32 `json:"size"` FeeSat big.Int Fee common.JSONNumber `json:"fee"` ModifiedFeeSat big.Int ModifiedFee common.JSONNumber `json:"modifiedfee"` Time uint64 `json:"time"` Height uint32 `json:"height"` DescendantCount uint32 `json:"descendantcount"` DescendantSize uint32 `json:"descendantsize"` DescendantFees uint32 `json:"descendantfees"` AncestorCount uint32 `json:"ancestorcount"` AncestorSize uint32 `json:"ancestorsize"` AncestorFees uint32 `json:"ancestorfees"` Depends []string `json:"depends"` }
MempoolEntry is used to get data about mempool entry
type MempoolEthereumType ¶ added in v0.2.0
type MempoolEthereumType struct { BaseMempool // contains filtered or unexported fields }
MempoolEthereumType is mempool handle of EthereumType chains
func NewMempoolEthereumType ¶ added in v0.2.0
func NewMempoolEthereumType(chain BlockChain, mempoolTxTimeoutHours int, queryBackendOnResync bool) *MempoolEthereumType
NewMempoolEthereumType creates new mempool handler.
func (*MempoolEthereumType) AddTransactionToMempool ¶ added in v0.2.2
func (m *MempoolEthereumType) AddTransactionToMempool(txid string)
AddTransactionToMempool adds transactions to mempool
func (*MempoolEthereumType) RemoveTransactionFromMempool ¶ added in v0.2.2
func (m *MempoolEthereumType) RemoveTransactionFromMempool(txid string)
RemoveTransactionFromMempool removes transaction from mempool
func (*MempoolEthereumType) Resync ¶ added in v0.2.0
func (m *MempoolEthereumType) Resync() (int, error)
Resync ethereum type removes timed out transactions and returns number of transactions in mempool. Transactions are added/removed by AddTransactionToMempool/RemoveTransactionFromMempool methods
type MempoolTx ¶ added in v0.3.5
type MempoolTx struct { Hex string `json:"hex"` Txid string `json:"txid"` Version int32 `json:"version"` LockTime uint32 `json:"locktime"` Vin []MempoolVin `json:"vin"` Vout []Vout `json:"vout"` Blocktime int64 `json:"blocktime,omitempty"` Erc20 []Erc20Transfer `json:"-"` CoinSpecificData interface{} `json:"-"` }
MempoolTx is blockchain transaction in mempool optimized for onNewTx notification
type MempoolTxidEntries ¶ added in v0.2.2
type MempoolTxidEntries []MempoolTxidEntry
MempoolTxidEntries is array of MempoolTxidEntry
func (MempoolTxidEntries) Len ¶ added in v0.2.2
func (a MempoolTxidEntries) Len() int
func (MempoolTxidEntries) Less ¶ added in v0.2.2
func (a MempoolTxidEntries) Less(i, j int) bool
func (MempoolTxidEntries) Swap ¶ added in v0.2.2
func (a MempoolTxidEntries) Swap(i, j int)
type MempoolTxidEntry ¶ added in v0.2.2
MempoolTxidEntry contains mempool txid with first seen time
type MempoolVin ¶ added in v0.3.5
type MempoolVin struct { Vin AddrDesc AddressDescriptor `json:"-"` ValueSat big.Int AssetInfo *AssetInfo `json:"assetInfo,omitempty"` }
MempoolVin contains data about tx input
type NotaryDetails ¶ added in v0.3.5
type NotaryDetails = wire.NotaryDetailsType
type NotificationType ¶
type NotificationType int
NotificationType is type of notification
const ( // NotificationUnknown is unknown NotificationUnknown NotificationType = iota // NotificationNewBlock message is sent when there is a new block to be imported NotificationNewBlock NotificationType = iota // NotificationNewTx message is sent when there is a new mempool transaction NotificationNewTx NotificationType = iota )
type OnNewBlockFunc ¶
OnNewBlockFunc is used to send notification about a new block
type OnNewTxAddrFunc ¶
type OnNewTxAddrFunc func(tx *Tx, desc AddressDescriptor)
OnNewTxAddrFunc is used to send notification about a new transaction/address
type OnNewTxFunc ¶ added in v0.3.5
type OnNewTxFunc func(tx *MempoolTx)
OnNewTxFunc is used to send notification about a new transaction/address
type ProtoTransaction ¶
type ProtoTransaction struct { Txid []byte `protobuf:"bytes,1,opt,name=Txid,proto3" json:"Txid,omitempty"` Hex []byte `protobuf:"bytes,2,opt,name=Hex,proto3" json:"Hex,omitempty"` Blocktime uint64 `protobuf:"varint,3,opt,name=Blocktime" json:"Blocktime,omitempty"` Locktime uint32 `protobuf:"varint,4,opt,name=Locktime" json:"Locktime,omitempty"` Height uint32 `protobuf:"varint,5,opt,name=Height" json:"Height,omitempty"` Vin []*ProtoTransaction_VinType `protobuf:"bytes,6,rep,name=Vin" json:"Vin,omitempty"` Vout []*ProtoTransaction_VoutType `protobuf:"bytes,7,rep,name=Vout" json:"Vout,omitempty"` Version int32 `protobuf:"varint,8,opt,name=Version" json:"Version,omitempty"` }
func (*ProtoTransaction) Descriptor ¶
func (*ProtoTransaction) Descriptor() ([]byte, []int)
func (*ProtoTransaction) GetBlocktime ¶
func (m *ProtoTransaction) GetBlocktime() uint64
func (*ProtoTransaction) GetHeight ¶
func (m *ProtoTransaction) GetHeight() uint32
func (*ProtoTransaction) GetHex ¶
func (m *ProtoTransaction) GetHex() []byte
func (*ProtoTransaction) GetLocktime ¶
func (m *ProtoTransaction) GetLocktime() uint32
func (*ProtoTransaction) GetTxid ¶
func (m *ProtoTransaction) GetTxid() []byte
func (*ProtoTransaction) GetVersion ¶ added in v0.2.0
func (m *ProtoTransaction) GetVersion() int32
func (*ProtoTransaction) GetVin ¶
func (m *ProtoTransaction) GetVin() []*ProtoTransaction_VinType
func (*ProtoTransaction) GetVout ¶
func (m *ProtoTransaction) GetVout() []*ProtoTransaction_VoutType
func (*ProtoTransaction) ProtoMessage ¶
func (*ProtoTransaction) ProtoMessage()
func (*ProtoTransaction) Reset ¶
func (m *ProtoTransaction) Reset()
func (*ProtoTransaction) String ¶
func (m *ProtoTransaction) String() string
type ProtoTransaction_VinType ¶
type ProtoTransaction_VinType struct { Coinbase string `protobuf:"bytes,1,opt,name=Coinbase" json:"Coinbase,omitempty"` Txid []byte `protobuf:"bytes,2,opt,name=Txid,proto3" json:"Txid,omitempty"` Vout uint32 `protobuf:"varint,3,opt,name=Vout" json:"Vout,omitempty"` ScriptSigHex []byte `protobuf:"bytes,4,opt,name=ScriptSigHex,proto3" json:"ScriptSigHex,omitempty"` Sequence uint32 `protobuf:"varint,5,opt,name=Sequence" json:"Sequence,omitempty"` Addresses []string `protobuf:"bytes,6,rep,name=Addresses" json:"Addresses,omitempty"` }
func (*ProtoTransaction_VinType) Descriptor ¶
func (*ProtoTransaction_VinType) Descriptor() ([]byte, []int)
func (*ProtoTransaction_VinType) GetAddresses ¶
func (m *ProtoTransaction_VinType) GetAddresses() []string
func (*ProtoTransaction_VinType) GetCoinbase ¶
func (m *ProtoTransaction_VinType) GetCoinbase() string
func (*ProtoTransaction_VinType) GetScriptSigHex ¶
func (m *ProtoTransaction_VinType) GetScriptSigHex() []byte
func (*ProtoTransaction_VinType) GetSequence ¶
func (m *ProtoTransaction_VinType) GetSequence() uint32
func (*ProtoTransaction_VinType) GetTxid ¶
func (m *ProtoTransaction_VinType) GetTxid() []byte
func (*ProtoTransaction_VinType) GetVout ¶
func (m *ProtoTransaction_VinType) GetVout() uint32
func (*ProtoTransaction_VinType) ProtoMessage ¶
func (*ProtoTransaction_VinType) ProtoMessage()
func (*ProtoTransaction_VinType) Reset ¶
func (m *ProtoTransaction_VinType) Reset()
func (*ProtoTransaction_VinType) String ¶
func (m *ProtoTransaction_VinType) String() string
type ProtoTransaction_VoutType ¶
type ProtoTransaction_VoutType struct { ValueSat []byte `protobuf:"bytes,1,opt,name=ValueSat,proto3" json:"ValueSat,omitempty"` N uint32 `protobuf:"varint,2,opt,name=N" json:"N,omitempty"` ScriptPubKeyHex []byte `protobuf:"bytes,3,opt,name=ScriptPubKeyHex,proto3" json:"ScriptPubKeyHex,omitempty"` Addresses []string `protobuf:"bytes,4,rep,name=Addresses" json:"Addresses,omitempty"` }
func (*ProtoTransaction_VoutType) Descriptor ¶
func (*ProtoTransaction_VoutType) Descriptor() ([]byte, []int)
func (*ProtoTransaction_VoutType) GetAddresses ¶
func (m *ProtoTransaction_VoutType) GetAddresses() []string
func (*ProtoTransaction_VoutType) GetN ¶
func (m *ProtoTransaction_VoutType) GetN() uint32
func (*ProtoTransaction_VoutType) GetScriptPubKeyHex ¶
func (m *ProtoTransaction_VoutType) GetScriptPubKeyHex() []byte
func (*ProtoTransaction_VoutType) GetValueSat ¶ added in v0.1.0
func (m *ProtoTransaction_VoutType) GetValueSat() []byte
func (*ProtoTransaction_VoutType) ProtoMessage ¶
func (*ProtoTransaction_VoutType) ProtoMessage()
func (*ProtoTransaction_VoutType) Reset ¶
func (m *ProtoTransaction_VoutType) Reset()
func (*ProtoTransaction_VoutType) String ¶
func (m *ProtoTransaction_VoutType) String() string
type ScriptPubKey ¶
type ScriptPubKey struct { // Asm string `json:"asm"` Hex string `json:"hex,omitempty"` // Type string `json:"type"` Addresses []string `json:"addresses"` }
ScriptPubKey contains data about output script
type ScriptSig ¶
type ScriptSig struct { // Asm string `json:"asm"` Hex string `json:"hex"` }
ScriptSig contains data about input script
type Token ¶ added in v0.3.4
type Token struct { Type TokenType `json:"type"` Name string `json:"name"` Path string `json:"path,omitempty"` Contract string `json:"contract,omitempty"` Transfers uint32 `json:"transfers"` Symbol string `json:"symbol,omitempty"` Decimals int `json:"decimals"` BalanceSat *Amount `json:"balance,omitempty"` TotalReceivedSat *Amount `json:"totalReceived,omitempty"` TotalSentSat *Amount `json:"totalSent,omitempty"` ContractIndex string `json:"-"` AddrStr string `json:"addrStr,omitempty"` }
Token contains info about tokens held by an address
type TokenTransferSummary ¶ added in v0.3.4
type TokenTransferSummary struct { From string `json:"from"` To string `json:"to"` Token uint32 `json:"token"` Name string `json:"name"` Symbol string `json:"symbol"` Decimals int `json:"decimals"` Value *Amount `json:"valueOut"` Fee *Amount `json:"fee"` AuxFeeDetails *AuxFeeDetails }
TokenTransferSummary contains info about a token transfer done in a transaction
type TokenType ¶ added in v0.3.4
type TokenType string
TokenType specifies type of token
const ERC20TokenType TokenType = "ERC20"
ERC20TokenType is Ethereum ERC20 token
const SPTAssetActivateType TokenType = "SPTAssetActivate"
const SPTAssetAllocationBurnToEthereumType TokenType = "SPTAssetAllocationBurnToEthereum"
const SPTAssetAllocationBurnToSyscoinType TokenType = "SPTAssetAllocationBurnToSyscoin"
const SPTAssetAllocationMintType TokenType = "SPTAssetAllocationMint"
const SPTAssetAllocationSendType TokenType = "SPTAssetAllocationSend"
const SPTAssetSendType TokenType = "SPTAssetSend"
const SPTAssetSyscoinBurnToAllocationType TokenType = "SPTSyscoinBurnToAssetAllocation"
const SPTAssetUpdateType TokenType = "SPTAssetUpdate"
const SPTNoneType TokenType = "Syscoin"
Syscoin SPT transaction
const SPTTokenType TokenType = "SPTAllocated"
const SPTUnknownType TokenType = "SPTUnknown"
const XPUBAddressTokenType TokenType = "XPUBAddress"
XPUBAddressTokenType is address derived from xpub
type Tx ¶
type Tx struct { Hex string `json:"hex"` Txid string `json:"txid"` Version int32 `json:"version"` LockTime uint32 `json:"locktime"` Vin []Vin `json:"vin"` Vout []Vout `json:"vout"` BlockHeight uint32 `json:"blockHeight,omitempty"` // BlockHash string `json:"blockhash,omitempty"` Confirmations uint32 `json:"confirmations,omitempty"` Time int64 `json:"time,omitempty"` Blocktime int64 `json:"blocktime,omitempty"` CoinSpecificData interface{} `json:"-"` }
Tx is blockchain transaction unnecessary fields are commented out to avoid overhead
type TxAddresses ¶ added in v0.3.4
TxAddresses stores transaction inputs and outputs with amounts
type TxAsset ¶ added in v0.3.4
type TxAsset struct { Height uint32 Txs []*TxAssetIndex }
type TxAssetAddress ¶ added in v0.3.5
type TxAssetAddress struct {
Txs []*TxAssetAddressIndex
}
type TxAssetAddressIndex ¶ added in v0.3.5
type TxAssetAddressIndex struct { AddrDesc AddressDescriptor BtxID []byte }
used to store all unique txid/address tuples related to an asset
type TxAssetAddressMap ¶ added in v0.3.5
type TxAssetAddressMap map[uint32]*TxAssetAddress
type TxAssetIndex ¶ added in v0.3.4
type TxAssetIndex struct { Type AssetsMask BtxID []byte }
used to store all txids related to an asset for asset history
type TxAssetMap ¶ added in v0.3.5
type TxIndexes ¶ added in v0.3.4
type TxIndexes struct { BtxID []byte Indexes []int32 Type AssetsMask }
Addresses index
type TxInput ¶ added in v0.3.4
type TxInput struct { AddrDesc AddressDescriptor ValueSat big.Int AssetInfo *AssetInfo `json:"assetInfo,omitempty"` }
TxInput holds input data of the transaction in TxAddresses
type TxOutput ¶ added in v0.3.4
type TxOutput struct { AddrDesc AddressDescriptor Spent bool ValueSat big.Int AssetInfo *AssetInfo `json:"assetInfo,omitempty"` }
TxOutput holds output data of the transaction in TxAddresses
type Utxo ¶ added in v0.3.4
type Utxo struct { BtxID []byte Vout int32 Height uint32 ValueSat big.Int AssetInfo *AssetInfo `json:"assetInfo,omitempty"` }
Utxo holds information about unspent transaction output
type Vin ¶
type Vin struct { Coinbase string `json:"coinbase"` Txid string `json:"txid"` Vout uint32 `json:"vout"` ScriptSig ScriptSig `json:"scriptSig"` Sequence uint32 `json:"sequence"` Addresses []string `json:"addresses"` AssetInfo *AssetInfo `json:"assetInfo,omitempty"` }
Vin contains data about tx input
type Vout ¶
type Vout struct { ValueSat big.Int JsonValue common.JSONNumber `json:"value"` N uint32 `json:"n"` ScriptPubKey ScriptPubKey `json:"scriptPubKey"` AssetInfo *AssetInfo `json:"assetInfo,omitempty"` }
Vout contains data about tx output