Documentation
¶
Overview ¶
Copyright (c) 2020 Michael Madgett Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
Copyright (c) 2020 Michael Madgett Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
Copyright (c) 2020 Michael Madgett Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
Copyright (c) 2020 Michael Madgett Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
Copyright (c) 2020 Michael Madgett Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
Index ¶
- Variables
- type Plugin
- func (bp *Plugin) AddBlocks(blocks []byte) ([]*data.Tx, error)
- func (bp *Plugin) AddTransactionToCache(tx *data.Tx)
- func (bp *Plugin) BlocksDir() string
- func (bp *Plugin) Config() chaincfg.Params
- func (bp *Plugin) GetRawMempool() ([]string, error)
- func (bp *Plugin) GetRawTransaction(txid string) (*wire.MsgTx, error)
- func (bp *Plugin) GetRawTransactions(txids []string) ([]*wire.MsgTx, error)
- func (bp *Plugin) ImportTransactions(transactions []*wire.MsgTx) ([]*data.Tx, error)
- func (bp *Plugin) ListTransactions(fromTime, toTime int64, addresses []string) ([]*data.Tx, error)
- func (bp *Plugin) LoadBlocks(blocksDir string) error
- func (bp *Plugin) Mu() *sync.RWMutex
- func (bp *Plugin) Network() wire.BitcoinNet
- func (bp *Plugin) ProcessBlocks(sc *bufio.Reader) ([]*data.Tx, error)
- func (bp *Plugin) ProcessTxShard(blocks []*data.ChainBlock, start, end int, wg *sync.WaitGroup) []*data.Tx
- func (bp *Plugin) ProcessTxs(sendTxs []*data.Tx, receiveTxs []*data.Tx) []*data.Tx
- func (bp *Plugin) ReadBlock(buf io.ReadSeeker) (*wire.MsgBlock, error)
- func (bp *Plugin) ReadBlockHeader(buf io.ReadSeeker) (header *wire.BlockHeader, err error)
- func (bp *Plugin) ReadBlocks(sc *bufio.Reader) ([]*data.ChainBlock, error)
- func (bp *Plugin) ReadTransaction(buf io.ReadSeeker) (*wire.MsgTx, error)
- func (bp *Plugin) Ready() bool
- func (bp *Plugin) SegwitActivated() int64
- func (bp *Plugin) SetReady()
- func (bp *Plugin) Ticker() string
- func (bp *Plugin) TokenConf() data.TokenConfig
- func (bp *Plugin) TxCache() map[string]map[string]*data.Tx
- func (bp *Plugin) TxIndex() map[wire.OutPoint]*data.BlockTx
- func (bp *Plugin) WriteListTransactions(fromMonth time.Time, toMonth time.Time, txDir string) error
- func (bp *Plugin) WriteListTransactionsForAddress(address string, fromMonth time.Time, toMonth time.Time, txDir string) error
Constants ¶
This section is empty.
Variables ¶
var MainNetParams = chaincfg.Params{ Name: "mainnet", Net: 0xd9b4bef9, DefaultPort: "8333", Bech32HRPSegwit: "bc", PubKeyHashAddrID: 0x00, ScriptHashAddrID: 0x05, PrivateKeyID: 0x80, WitnessPubKeyHashAddrID: 0x06, WitnessScriptHashAddrID: 0x0A, HDPrivateKeyID: [4]byte{0x04, 0x88, 0xad, 0xe4}, HDPublicKeyID: [4]byte{0x04, 0x88, 0xb2, 0x1e}, HDCoinType: 0x0, }
MainNetParams returns the chain configuration for mainnet.
var TestnetParams = chaincfg.Params{ Name: "testnet", Net: 0x0709110b, DefaultPort: "18333", Bech32HRPSegwit: "tb", PubKeyHashAddrID: 0x6f, ScriptHashAddrID: 0xc4, PrivateKeyID: 0xef, WitnessPubKeyHashAddrID: 0x06, WitnessScriptHashAddrID: 0x0A, HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xcf}, HDCoinType: 0x1, }
TestnetParams returns the chain configuration for testnet.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func NewPlugin ¶
func NewPlugin(cfg *chaincfg.Params, tokenCfg data.TokenConfig) *Plugin
NewPlugin returns new BLOCK plugin instance.
func (*Plugin) AddBlocks ¶
AddBlocks process new blocks received by the network to keep internal chain data up to date.
func (*Plugin) AddTransactionToCache ¶
AddAddrToCache adds the transaction to the cache.
func (*Plugin) GetRawMempool ¶
GetRawMempool calls getrawmempool on the specified rpc endpoint.
func (*Plugin) GetRawTransaction ¶
GetRawTransaction calls getrawtransaction on the specified rpc endpoint.
func (*Plugin) GetRawTransactions ¶
GetRawTransactions calls getrawtransaction on the specified rpc endpoint.
func (*Plugin) ImportTransactions ¶
ImportTransactions imports the specified transactions into the data store.
func (*Plugin) ListTransactions ¶
ListTransactions lists all transactions during the time period.
func (*Plugin) LoadBlocks ¶
LoadBlocks load all transactions in the blocks dir.
func (*Plugin) Network ¶
func (bp *Plugin) Network() wire.BitcoinNet
Network returns the network magic number.
func (*Plugin) ProcessBlocks ¶
ProcessBlocks will process all blocks in the buffer.
func (*Plugin) ProcessTxShard ¶
func (bp *Plugin) ProcessTxShard(blocks []*data.ChainBlock, start, end int, wg *sync.WaitGroup) []*data.Tx
ProcessTxShard processes all transactions over specified range of blocks. Creates all send and receive transactions in the range. This func is thread safe.
func (*Plugin) ProcessTxs ¶
ProcessTxs processes and consolidates send and receive transactions.
func (*Plugin) ReadBlockHeader ¶
func (bp *Plugin) ReadBlockHeader(buf io.ReadSeeker) (header *wire.BlockHeader, err error)
ReadBlockHeader deserializes block header.
func (*Plugin) ReadBlocks ¶
ReadBlocks loads block from the reader.
func (*Plugin) ReadTransaction ¶
ReadTransaction deserializes bytes into transaction
func (*Plugin) SegwitActivated ¶
SegwitActivated returns the segwit activation unix time.
func (*Plugin) TokenConf ¶
func (bp *Plugin) TokenConf() data.TokenConfig
TokenConf returns the token configuration.
func (*Plugin) WriteListTransactions ¶
WriteListTransactions writes transactions to disk at the specified location. Uses the format [txDir]/listtransactions/BLOCK/BoWcezbZ9vFTwArtVTHJHp51zQZSGdcLXt/2020-06.json
func (*Plugin) WriteListTransactionsForAddress ¶
func (bp *Plugin) WriteListTransactionsForAddress(address string, fromMonth time.Time, toMonth time.Time, txDir string) error
WriteListTransactionsForAddress writes transactions to disk at the specified location. Uses the format [txDir]/listtransactions/BLOCK/BoWcezbZ9vFTwArtVTHJHp51zQZSGdcLXt/2020-06.json