pivx

package
v0.0.0-...-02504b7 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Net Magics
	MainnetMagic wire.BitcoinNet = 0xe9fdc490
	TestnetMagic wire.BitcoinNet = 0xba657645

	// Zerocoin op codes
	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

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 PivX network

func NewPivXRPC

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

NewPivXRPC returns new PivXRPC instance.

func Uint16

func Uint16(r io.Reader, byteOrder binary.ByteOrder) (uint16, error)

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

func Uint32(r io.Reader, byteOrder binary.ByteOrder) (uint32, error)

Uint32 reads four bytes from the provided reader, converts it to a number using the provided byte order, and returns the resulting uint32.

func Uint64

func Uint64(r io.Reader, byteOrder binary.ByteOrder) (uint64, error)

Uint64 reads eight bytes from the provided reader, converts it to a number using the provided byte order, and returns the resulting uint64.

func Uint8

func Uint8(r io.Reader) (uint8, error)

Uint8 reads one byte from the provided reader and returns the resulting uint8.

Types

type CmdFindSerial

type CmdFindSerial struct {
	Method string   `json:"method"`
	Params []string `json:"params"`
}

findserial

type CmdGetInfo

type CmdGetInfo struct {
	Method string `json:"method"`
}

type CmdGetMasternodeCount

type CmdGetMasternodeCount struct {
	Method string `json:"method"`
}

type PivXParser

type PivXParser struct {
	*btc.BitcoinParser

	BitcoinOutputScriptToAddressesFunc btc.OutputScriptToAddressesFunc
	// contains filtered or unexported fields
}

PivXParser handle

func NewPivXParser

func NewPivXParser(params *chaincfg.Params, c *btc.Configuration) *PivXParser

NewPivXParser returns new PivXParser instance

func (*PivXParser) GetAddrDescForUnknownInput

func (p *PivXParser) GetAddrDescForUnknownInput(tx *bchain.Tx, input int) bchain.AddressDescriptor

func (*PivXParser) GetValueSatForUnknownInput

func (p *PivXParser) GetValueSatForUnknownInput(tx *bchain.Tx, input int) *big.Int

func (*PivXParser) GetValueSatFromZerocoinSpend

func (p *PivXParser) GetValueSatFromZerocoinSpend(signatureScript []byte) (*big.Int, error)

Decodes the amount from the zerocoin spend script

func (*PivXParser) IsAddrDescIndexable

func (p *PivXParser) 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 (*PivXParser) P2CSScriptToAddress

func (p *PivXParser) P2CSScriptToAddress(script []byte) ([]string, bool, error)

Returns P2CS owner/staker addresses

func (*PivXParser) PackTx

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

PackTx packs transaction to byte array using protobuf

func (*PivXParser) ParseBlock

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

ParseBlock parses raw block to our Block struct

func (*PivXParser) ParseTx

func (p *PivXParser) ParseTx(b []byte) (*bchain.Tx, error)

ParseTx parses byte array containing transaction and returns Tx struct

func (*PivXParser) ParseTxFromJson

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

ParseTxFromJson parses JSON message containing transaction and returns Tx struct

func (*PivXParser) TxFromMsgTx

func (p *PivXParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.Tx

Parses tx and adds handling for OP_ZEROCOINSPEND inputs

func (*PivXParser) UnpackTx

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

UnpackTx unpacks transaction from protobuf byte array

type PivXRPC

type PivXRPC struct {
	*btc.BitcoinRPC
	BitcoinGetChainInfo func() (*bchain.ChainInfo, error)
}

PivXRPC is an interface to JSON-RPC bitcoind service.

func (*PivXRPC) Findzcserial

func (b *PivXRPC) Findzcserial(serialHex string) (string, error)

func (*PivXRPC) GetChainInfo

func (b *PivXRPC) GetChainInfo() (*bchain.ChainInfo, error)

GetChainInfo returns information about the connected backend PIVX adds MoneySupply and ZerocoinSupply to btc implementation

func (*PivXRPC) GetNextSuperBlock

func (b *PivXRPC) GetNextSuperBlock(nHeight int) int

GetNextSuperBlock returns the next superblock height after nHeight

func (*PivXRPC) Initialize

func (b *PivXRPC) Initialize() error

Initialize initializes PivXRPC instance.

type ResFindSerial

type ResFindSerial struct {
	Error  *bchain.RPCError `json:"error"`
	Result struct {
		Success bool   `json:"success"`
		Txid    string `json:"txid"`
	} `json:"result"`
}

type ResGetInfo

type ResGetInfo struct {
	Error  *bchain.RPCError `json:"error"`
	Result struct {
		MoneySupply    json.Number     `json:"moneysupply"`
		ZerocoinSupply bchain.ZCdenoms `json:"zPIVsupply"`
	} `json:"result"`
}

type ResGetMasternodeCount

type ResGetMasternodeCount struct {
	Error  *bchain.RPCError `json:"error"`
	Result struct {
		Total   int `json:"total"`
		Stable  int `json:"stable"`
		Enabled int `json:"enabled"`
		InQueue int `json:"inqueue"`
	} `json:"result"`
}

Jump to

Keyboard shortcuts

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