types

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Identifier = "73424348" // ascii code for 'sBCH'
	Version    = "00"

	ShaGateAddress = "14f8c7e99fd4e867c34cbd5968e35575fd5919a4"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BCHBlock

type BCHBlock struct {
	Height          int64
	Timestamp       int64
	HashId          [32]byte
	ParentBlk       [32]byte
	Nominations     []stakingtypes.Nomination
	CCTransferInfos []*cctypes.CCTransferInfo
}

This struct contains the useful information of a BCH block

func (*BCHBlock) Equal

func (b *BCHBlock) Equal(o *BCHBlock) bool

not check Nominations

type BlockCountResp

type BlockCountResp struct {
	Result int64         `json:"result"`
	Error  *JsonRpcError `json:"error"`
	Id     string        `json:"id"`
}

type BlockHashResp

type BlockHashResp struct {
	Result string        `json:"result"`
	Error  *JsonRpcError `json:"error"`
	Id     string        `json:"id"`
}

type BlockInfo

type BlockInfo struct {
	Hash              string   `json:"hash"`
	Confirmations     int      `json:"confirmations"`
	Size              int      `json:"size"`
	Height            int64    `json:"height"`
	Version           int      `json:"version"`
	VersionHex        string   `json:"versionHex"`
	Merkleroot        string   `json:"merkleroot"`
	Tx                []TxInfo `json:"tx"`
	RawTx             []TxInfo `json:"rawtx"` // BCHD
	Time              int64    `json:"time"`
	MedianTime        int64    `json:"mediantime"`
	Nonce             int      `json:"nonce"`
	Bits              string   `json:"bits"`
	Difficulty        float64  `json:"difficulty"`
	Chainwork         string   `json:"chainwork"`
	NumTx             int      `json:"nTx"`
	PreviousBlockhash string   `json:"previousblockhash"`
}

type BlockInfoResp

type BlockInfoResp struct {
	Result BlockInfo     `json:"result"`
	Error  *JsonRpcError `json:"error"`
	Id     string        `json:"id"`
}

type CoinbaseVin

type CoinbaseVin struct {
	Coinbase string `json:"coinbase"`
	Sequence int    `json:"sequence"`
}

type JsonRpcError

type JsonRpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

**mainnet data structure

type RpcClient

type RpcClient interface {
	GetLatestHeight(retry bool) int64
	GetBlockByHeight(height int64, retry bool) *BCHBlock
	GetEpochs(start, end uint64) []*stakingtypes.Epoch
	GetCCEpochs(start, end uint64) []*cctypes.CCEpoch
}

These functions must be provided by a client connecting to a Bitcoin Cash's fullnode

type TxInfo

type TxInfo struct {
	TxID          string                   `json:"txid"`
	Hash          string                   `json:"hash"`
	Version       int                      `json:"version"`
	Size          int                      `json:"size"`
	Locktime      int                      `json:"locktime"`
	VinList       []map[string]interface{} `json:"vin"`
	VoutList      []Vout                   `json:"vout"`
	Hex           string                   `json:"hex"`
	Blockhash     string                   `json:"blockhash"`
	Confirmations int                      `json:"confirmations"`
	Time          int64                    `json:"time"`
	BlockTime     int64                    `json:"blocktime"`
}

func (TxInfo) GetCCTransferInfos added in v0.4.0

func (ti TxInfo) GetCCTransferInfos() (infos []*cctypes.CCTransferInfo)

func (TxInfo) GetValidatorPubKey

func (ti TxInfo) GetValidatorPubKey() (pubKey [32]byte, success bool)

type TxInfoResp

type TxInfoResp struct {
	Result TxInfo        `json:"result"`
	Error  *JsonRpcError `json:"error"`
	Id     string        `json:"id"`
}

type Vout

type Vout struct {
	Value        float64                `json:"value"`
	N            int                    `json:"n"`
	ScriptPubKey map[string]interface{} `json:"scriptPubKey"`
}

Jump to

Keyboard shortcuts

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