Documentation ¶
Index ¶
- Constants
- Variables
- func Store(data []byte, packetId byte, btcFee float64, options *rpc.RpcOptions) ([]string, error)
- type BlockMeta
- type BlockScanRequest
- type BlockScanResult
- type BlockScanWorker
- type CarbonChain
- func (cc *CarbonChain) Close()
- func (cc *CarbonChain) GetBlock(hash []byte) (*blockchainparser.Block, error)
- func (cc *CarbonChain) GetBlockAtHeight(height int) (*blockchainparser.Block, error)
- func (cc *CarbonChain) GetBlockConfirmation(hash []byte) (int, error)
- func (cc *CarbonChain) GetBlockHashAtHeight(height int) ([]byte, error)
- func (cc *CarbonChain) GetBlockchainHeight() (int, error)
- func (cc *CarbonChain) GetNextBlockInChain(hash []byte) (*blockchainparser.Block, error)
- func (cc *CarbonChain) GetNextHashInChain(hash []byte) ([]byte, error)
- func (cc *CarbonChain) GetTransaction(hash []byte) (*blockchainparser.Transaction, error)
- func (cc *CarbonChain) GetTransactionBlockHash(hash []byte) ([]byte, error)
- func (cc *CarbonChain) GetTransactionMeta(hash []byte) (*TransactionMeta, error)
- func (cc *CarbonChain) Init() error
- func (cc *CarbonChain) Watch(done chan bool) error
- type CarbonChainOptions
- type Datapack
- type OutputAddr
- type Packet
- type PacketChecksum
- type TransactionMeta
Constants ¶
View Source
const ( LOG_LEVEL_VERBOSE = iota LOG_LEVEL_INFO = iota LOG_LEVEL_DEBUG = iota LOG_LEVEL_ERROR = iota )
View Source
const BITCOIN_BTC_DUST float32 = 0.00001
View Source
const OP_RETURN_MAX_BLOCKS int = 64
View Source
const OP_RETURN_MAX_BYTES int = 80
View Source
const PACKET_HEADER_SIZE int = 20
Variables ¶
View Source
var MAX_WORKERS = os.Getenv("MAX_WORKERS")
Functions ¶
Types ¶
type BlockMeta ¶
type BlockMeta struct { FileNum uint32 `struc:"little"` Pos uint64 `struc:"little"` HashPrev blockchainparser.Hash256 `struc:"little,[32]byte"` }
type BlockScanRequest ¶
type BlockScanResult ¶
type BlockScanResult struct {
Index int
}
type BlockScanWorker ¶
type BlockScanWorker struct { JobChannel chan BlockScanRequest ResultChannel chan BlockScanResult // contains filtered or unexported fields }
func NewBlockScanWorker ¶
func NewBlockScanWorker(cc *CarbonChain, jobChannel chan BlockScanRequest, resultChannel chan BlockScanResult) *BlockScanWorker
func (*BlockScanWorker) Start ¶
func (w *BlockScanWorker) Start()
func (*BlockScanWorker) Stop ¶
func (w *BlockScanWorker) Stop()
type CarbonChain ¶
type CarbonChain struct { Options *CarbonChainOptions BlockDb *bolt.DB ChainDb *bolt.DB CarbonDb *bolt.DB // contains filtered or unexported fields }
func NewCarbonChain ¶
func NewCarbonChain(blockDb *bolt.DB, chainDb *bolt.DB, carbonDb *bolt.DB, options *CarbonChainOptions) (*CarbonChain, error)
func NewCarbonChainWithDb ¶
func NewCarbonChainWithDb(options *CarbonChainOptions) (*CarbonChain, error)
func (*CarbonChain) Close ¶
func (cc *CarbonChain) Close()
func (*CarbonChain) GetBlock ¶
func (cc *CarbonChain) GetBlock(hash []byte) (*blockchainparser.Block, error)
func (*CarbonChain) GetBlockAtHeight ¶
func (cc *CarbonChain) GetBlockAtHeight(height int) (*blockchainparser.Block, error)
func (*CarbonChain) GetBlockConfirmation ¶
func (cc *CarbonChain) GetBlockConfirmation(hash []byte) (int, error)
func (*CarbonChain) GetBlockHashAtHeight ¶
func (cc *CarbonChain) GetBlockHashAtHeight(height int) ([]byte, error)
func (*CarbonChain) GetBlockchainHeight ¶
func (cc *CarbonChain) GetBlockchainHeight() (int, error)
func (*CarbonChain) GetNextBlockInChain ¶
func (cc *CarbonChain) GetNextBlockInChain(hash []byte) (*blockchainparser.Block, error)
func (*CarbonChain) GetNextHashInChain ¶
func (cc *CarbonChain) GetNextHashInChain(hash []byte) ([]byte, error)
func (*CarbonChain) GetTransaction ¶
func (cc *CarbonChain) GetTransaction(hash []byte) (*blockchainparser.Transaction, error)
func (*CarbonChain) GetTransactionBlockHash ¶
func (cc *CarbonChain) GetTransactionBlockHash(hash []byte) ([]byte, error)
func (*CarbonChain) GetTransactionMeta ¶
func (cc *CarbonChain) GetTransactionMeta(hash []byte) (*TransactionMeta, error)
func (*CarbonChain) Init ¶
func (cc *CarbonChain) Init() error
func (*CarbonChain) Watch ¶
func (cc *CarbonChain) Watch(done chan bool) error
type CarbonChainOptions ¶
type CarbonChainOptions struct { Testnet bool BlockMagicId blockchainparser.MagicId PacketId byte GenesisBlock blockchainparser.Hash256 DataDir string ProcessFunc func(cc *CarbonChain, carbonDb *bolt.DB) LogLevel int }
type Datapack ¶
type Datapack struct { TxIds []blockchainparser.Hash256 Version int8 OutputAddr OutputAddr Data []byte Timestamp int64 }
func NewDatapackFromBytes ¶
type OutputAddr ¶
type OutputAddr [20]byte
func (OutputAddr) String ¶
func (outputAddr OutputAddr) String() string
type Packet ¶
type Packet struct { Id byte Version int8 Sequence int16 Checksum PacketChecksum NextChecksum PacketChecksum Data []byte // fields below only exists in db, not on blockchain Txid blockchainparser.Hash256 // txId this packet was extracted from OutputAddr OutputAddr // outputAddr this packet belongs to Timestamp int64 // time this packet is inserted into db }
func NewPacketFromBytes ¶
func NewPacketFromDbBytes ¶
func (*Packet) CalculateChecksum ¶
type PacketChecksum ¶
type PacketChecksum [8]byte
func (PacketChecksum) String ¶
func (packetChecksum PacketChecksum) String() string
type TransactionMeta ¶
type TransactionMeta struct { FileNum uint32 `struc:"little"` BlockHash blockchainparser.Hash256 `struc:"little,[32]byte"` Pos uint64 `struc:"little"` Index uint32 `struc:"little"` }
Click to show internal directories.
Click to hide internal directories.