xzc

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpZeroCoinMint  = 0xc1
	OpZeroCoinSpend = 0xc2

	MainnetMagic wire.BitcoinNet = 0xe3d9fef1
	TestnetMagic wire.BitcoinNet = 0xcffcbeea
	RegtestMagic wire.BitcoinNet = 0xfabfb5da

	GenesisBlockTime       = 1414776286
	SwitchToMTPBlockHeader = 1544443200
	MTPL                   = 64

	SpendTxID = "0000000000000000000000000000000000000000000000000000000000000000"
)

Variables

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

Functions

func GetChainParams

func GetChainParams(chain string) *chaincfg.Params

GetChainParams contains network parameters for the main Zcoin network, the regression test Zcoin network, the test Zcoin network and the simulation test Zcoin network, in this order

func NewZcoinRPC

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

Types

type MTPBlockHeader

type MTPBlockHeader struct {
	VersionMTP   int32
	MTPHashValue chainhash.Hash
	Reserved1    chainhash.Hash
	Reserved2    chainhash.Hash
}

type MTPHashData

type MTPHashData struct {
	HashRootMTP [16]uint8
	BlockMTP    [128][128]uint64
}

type ZcoinParser

type ZcoinParser struct {
	*btc.BitcoinParser
}

ZcoinParser handle

func NewZcoinParser

func NewZcoinParser(params *chaincfg.Params, c *btc.Configuration) *ZcoinParser

NewZcoinParser returns new ZcoinParser instance

func (*ZcoinParser) GetAddressesFromAddrDesc

func (p *ZcoinParser) GetAddressesFromAddrDesc(addrDesc bchain.AddressDescriptor) ([]string, bool, error)

GetAddressesFromAddrDesc returns addresses for given address descriptor with flag if the addresses are searchable

func (*ZcoinParser) PackTx

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

PackTx packs transaction to byte array using protobuf

func (*ZcoinParser) ParseBlock

func (p *ZcoinParser) ParseBlock(b []byte) (*bchain.Block, error)

ParseBlock parses raw block to our Block struct

func (*ZcoinParser) ParseTxFromJson

func (p *ZcoinParser) ParseTxFromJson(msg json.RawMessage) (*bchain.Tx, error)

ParseTxFromJson parses JSON message containing transaction and returns Tx struct

func (*ZcoinParser) UnpackTx

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

UnpackTx unpacks transaction from protobuf byte array

type ZcoinRPC

type ZcoinRPC struct {
	*btc.BitcoinRPC
}

func (*ZcoinRPC) GetBlock

func (zc *ZcoinRPC) GetBlock(hash string, height uint32) (*bchain.Block, error)

func (*ZcoinRPC) GetBlockInfo

func (zc *ZcoinRPC) GetBlockInfo(hash string) (*bchain.BlockInfo, error)

func (*ZcoinRPC) GetBlockRaw

func (zc *ZcoinRPC) GetBlockRaw(hash string) ([]byte, error)

func (*ZcoinRPC) GetBlockWithoutHeader

func (zc *ZcoinRPC) GetBlockWithoutHeader(hash string, height uint32) (*bchain.Block, error)

func (*ZcoinRPC) GetTransaction

func (zc *ZcoinRPC) GetTransaction(txid string) (*bchain.Tx, error)

func (*ZcoinRPC) GetTransactionForMempool

func (zc *ZcoinRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error)

func (*ZcoinRPC) GetTransactionSpecific

func (zc *ZcoinRPC) GetTransactionSpecific(tx *bchain.Tx) (json.RawMessage, error)

func (*ZcoinRPC) Initialize

func (zc *ZcoinRPC) Initialize() error

Jump to

Keyboard shortcuts

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