bitcore

package
v0.0.0-...-fae8f5a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainnetMagic wire.BitcoinNet = 0xf9beb4d9
	TestnetMagic wire.BitcoinNet = 0xfdd2c8f1
	RegtestMagic wire.BitcoinNet = 0xfabfb5da
)

Variables

View Source
var (
	MainNetParams chaincfg.Params
	TestNetParams chaincfg.Params
)

Functions

func GetChainParams

func GetChainParams(chain string) *chaincfg.Params

GetChainParams contains network parameters for the main Bitcore network, and the test Bitcore network

func NewBitcoreRPC

func NewBitcoreRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error)

NewBitcoreRPC returns new BitcoreRPC instance.

Types

type BitcoreParser

type BitcoreParser struct {
	*btc.BitcoinLikeParser
	// contains filtered or unexported fields
}

BitcoreParser handle

func NewBitcoreParser

func NewBitcoreParser(params *chaincfg.Params, c *btc.Configuration) *BitcoreParser

NewBitcoreParser returns new BitcoreParser instance

func (*BitcoreParser) PackTx

func (p *BitcoreParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ([]byte, error)

PackTx packs transaction to byte array using protobuf

func (*BitcoreParser) UnpackTx

func (p *BitcoreParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error)

UnpackTx unpacks transaction from protobuf byte array

type BitcoreRPC

type BitcoreRPC struct {
	*btc.BitcoinRPC
}

BitcoreRPC is an interface to JSON-RPC bitcoind service.

func (*BitcoreRPC) GetBlock

func (f *BitcoreRPC) GetBlock(hash string, height uint32) (*bchain.Block, error)

func (*BitcoreRPC) GetBlockFull

func (f *BitcoreRPC) GetBlockFull(hash string) (*bchain.Block, error)

GetBlockFull returns block with given hash

func (*BitcoreRPC) GetTransactionForMempool

func (f *BitcoreRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error)

GetTransactionForMempool returns a transaction by the transaction ID. It could be optimized for mempool, i.e. without block time and confirmations

func (*BitcoreRPC) Initialize

func (b *BitcoreRPC) Initialize() error

Initialize initializes BitcoreRPC instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL