Documentation ¶
Index ¶
- Constants
- Variables
- func GetChainParams(chain string) *chaincfg.Params
- func NewBlackHatRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error)
- func Uint16(r io.Reader, byteOrder binary.ByteOrder) (uint16, error)
- func Uint32(r io.Reader, byteOrder binary.ByteOrder) (uint32, error)
- func Uint64(r io.Reader, byteOrder binary.ByteOrder) (uint64, error)
- func Uint8(r io.Reader) (uint8, error)
- type BlackHatParser
- func (p *BlackHatParser) GetAddrDescForUnknownInput(tx *bchain.Tx, input int) bchain.AddressDescriptor
- func (p *BlackHatParser) GetValueSatForUnknownInput(tx *bchain.Tx, input int) *big.Int
- func (p *BlackHatParser) GetValueSatFromZerocoinSpend(signatureScript []byte) (*big.Int, error)
- func (p *BlackHatParser) IsAddrDescIndexable(addrDesc bchain.AddressDescriptor) bool
- func (p *BlackHatParser) P2CSScriptToAddress(script []byte) ([]string, bool, error)
- func (p *BlackHatParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ([]byte, error)
- func (p *BlackHatParser) ParseTx(b []byte) (*bchain.Tx, error)
- func (p *BlackHatParser) ParseTxFromJson(msg json.RawMessage) (*bchain.Tx, error)
- func (p *BlackHatParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.Tx
- func (p *BlackHatParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error)
- type BlackHatRPC
- func (b *BlackHatRPC) Findzcserial(serialHex string) (string, error)
- func (z *BlackHatRPC) GetBlock(hash string, height uint32) (*bchain.Block, error)
- func (b *BlackHatRPC) GetChainInfo() (*bchain.ChainInfo, error)
- func (b *BlackHatRPC) GetNextSuperBlock(nHeight int) int
- func (b *BlackHatRPC) Initialize() error
- type CmdFindSerial
- type CmdGetInfo
- type CmdGetMasternodeCount
- type ResFindSerial
- type ResGetInfo
- type ResGetMasternodeCount
Constants ¶
const ( // Net Magics MainnetMagic wire.BitcoinNet = 0xd9fdc2fa TestnetMagic wire.BitcoinNet = 0xc0d890c5 // Opcodes OP_IF = 0x63 OP_ELSE = 0x67 OP_ENDIF = 0x68 OP_DUP = 0x76 OP_ROT = 0x7b OP_EQUALVERIFY = 0x88 OP_HASH160 = 0xa9 OP_CHECKSIG = 0xac OP_ZEROCOINMINT = 0xc1 OP_ZEROCOINSPEND = 0xc2 OP_CHECKCOLDSTAKEVERIFY = 0xd1 // Labels ZCMINT_LABEL = "Zerocoin Mint" ZCSPEND_LABEL = "Zerocoin Spend" CBASE_LABEL = "CoinBase TX" CSTAKE_LABEL = "CoinStake TX" // Dummy Internal Addresses CBASE_ADDR_INT = 0xf7 CSTAKE_ADDR_INT = 0xf8 // Staking Addresses STAKING_ADDR_MAIN = 63 STAKING_ADDR_TEST = 73 )
Variables ¶
var ( MainNetParams chaincfg.Params TestNetParams chaincfg.Params )
Functions ¶
func GetChainParams ¶
GetChainParams contains network parameters for the main BlackHat network
func NewBlackHatRPC ¶
func NewBlackHatRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error)
NewBlackHatRPC returns new BlackHatRPC instance.
func Uint16 ¶
Uint16 reads two bytes from the provided reader, converts it to a number using the provided byte order, and returns the resulting uint16.
func Uint32 ¶
Uint32 reads four bytes from the provided reader, converts it to a number using the provided byte order, and returns the resulting uint32.
Types ¶
type BlackHatParser ¶
type BlackHatParser struct { *btc.BitcoinParser BitcoinOutputScriptToAddressesFunc btc.OutputScriptToAddressesFunc // contains filtered or unexported fields }
BlackHatParser handle
func NewBlackHatParser ¶
func NewBlackHatParser(params *chaincfg.Params, c *btc.Configuration) *BlackHatParser
NewBlackHatParser returns new BlackHatParser instance
func (*BlackHatParser) GetAddrDescForUnknownInput ¶
func (p *BlackHatParser) GetAddrDescForUnknownInput(tx *bchain.Tx, input int) bchain.AddressDescriptor
func (*BlackHatParser) GetValueSatForUnknownInput ¶
func (*BlackHatParser) GetValueSatFromZerocoinSpend ¶
func (p *BlackHatParser) GetValueSatFromZerocoinSpend(signatureScript []byte) (*big.Int, error)
Decodes the amount from the zerocoin spend script
func (*BlackHatParser) IsAddrDescIndexable ¶
func (p *BlackHatParser) IsAddrDescIndexable(addrDesc bchain.AddressDescriptor) bool
IsAddrDescIndexable returns true if AddressDescriptor should be added to index empty or OP_RETURN scripts are not indexed. also are not indexed: zerocoin mints/spends coinbase txes and coinstake markers
func (*BlackHatParser) P2CSScriptToAddress ¶
func (p *BlackHatParser) P2CSScriptToAddress(script []byte) ([]string, bool, error)
Returns P2CS owner/staker addresses
func (*BlackHatParser) ParseTx ¶
func (p *BlackHatParser) ParseTx(b []byte) (*bchain.Tx, error)
ParseTx parses byte array containing transaction and returns Tx struct
func (*BlackHatParser) ParseTxFromJson ¶
func (p *BlackHatParser) ParseTxFromJson(msg json.RawMessage) (*bchain.Tx, error)
ParseTxFromJson parses JSON message containing transaction and returns Tx struct
func (*BlackHatParser) TxFromMsgTx ¶
Parses tx and adds handling for OP_ZEROCOINSPEND inputs
type BlackHatRPC ¶
type BlackHatRPC struct { *btc.BitcoinRPC BitcoinGetChainInfo func() (*bchain.ChainInfo, error) }
BlackHatRPC is an interface to JSON-RPC bitcoind service.
func (*BlackHatRPC) Findzcserial ¶
func (b *BlackHatRPC) Findzcserial(serialHex string) (string, error)
func (*BlackHatRPC) GetChainInfo ¶
func (b *BlackHatRPC) GetChainInfo() (*bchain.ChainInfo, error)
GetChainInfo returns information about the connected backend BlackHat adds Money Supply to btc implementation
func (*BlackHatRPC) GetNextSuperBlock ¶
func (b *BlackHatRPC) GetNextSuperBlock(nHeight int) int
GetNextSuperBlock returns the next superblock height after nHeight
func (*BlackHatRPC) Initialize ¶
func (b *BlackHatRPC) Initialize() error
Initialize initializes BlackHatRPC instance.
type CmdFindSerial ¶
findserial
type CmdGetInfo ¶
type CmdGetInfo struct {
Method string `json:"method"`
}
type CmdGetMasternodeCount ¶
type CmdGetMasternodeCount struct {
Method string `json:"method"`
}