Documentation ¶
Index ¶
- Variables
- func BuildPDEPoolForPairKey(beaconHeight uint64, token1IDStr string, token2IDStr string) []byte
- func EncodeBase58Check(b []byte) string
- func MakeProof(txType string, version int8, isTxNormal bool) privacy.Proof
- func NewTxNormalFromTxNormalRPC(data TxNormalRPC) (metadata.Transaction, error)
- func ParseTxDetail(txDetail TransactionDetail) (metadata.Transaction, error)
- func ParseTxTokenData(txTokenData []byte) (tx_generic.TxTokenData, error)
- type BeaconBestState
- type BestBlockItem
- type BestBlockResult
- type BlockHashResult
- type BlockInfo
- type CreateTransactionResult
- type CreateTransactionTokenResult
- type CurrentPDEState
- type ICoinInfo
- type InstructionProof
- type ListOutputCoins
- type MiningInfoResult
- type MissingSignature
- type NodePoolInfo
- type OutCoin
- type PDEContribution
- type Penalty
- type PoolInfo
- type RandomCommitmentAndPublicKeyResult
- type RandomCommitmentResult
- type ShardBestState
- type ShardCommitteeState
- type SyncInfo
- type SyncStats
- type TransactionDetail
- type TxNormalRPC
Constants ¶
This section is empty.
Variables ¶
var ( WaitingPDEContributionPrefix = []byte("waitingpdecontribution-") PDEPoolPrefix = []byte("pdepool-") PDETradingFeePrefix = []byte("pdetradingfee-") PDETradeFeePrefix = []byte("pdetradefee-") PDEContributionStatusPrefix = []byte("pdecontributionstatus-") PDETradeStatusPrefix = []byte("pdetradestatus-") PDEWithdrawalStatusPrefix = []byte("pdewithdrawalstatus-") PDEFeeWithdrawalStatusPrefix = []byte("pdefeewithdrawalstatus-") )
Functions ¶
func BuildPDEPoolForPairKey ¶
BuildPDEPoolForPairKey builds a pDEX pool-key for a pair of tokenIDs at the given beacon height.
func EncodeBase58Check ¶
EncodeBase58Check returns the base58-encoded string for a given byte slice.
func NewTxNormalFromTxNormalRPC ¶
func NewTxNormalFromTxNormalRPC(data TxNormalRPC) (metadata.Transaction, error)
NewTxNormalFromTxNormalRPC creates a txNormal object from RPC-resulting data.
func ParseTxDetail ¶
func ParseTxDetail(txDetail TransactionDetail) (metadata.Transaction, error)
ParseTxDetail parses a transaction detail into a transaction object.
func ParseTxTokenData ¶
func ParseTxTokenData(txTokenData []byte) (tx_generic.TxTokenData, error)
ParseTxTokenData parses a RPC token detail into a TxTokenData object.
Types ¶
type BeaconBestState ¶
type BeaconBestState struct { BestBlockHash common.Hash `json:"BestBlockHash"` // The hash of the block. PreviousBestBlockHash common.Hash `json:"PreviousBestBlockHash"` // The hash of the block. BestShardHash map[byte]common.Hash `json:"BestShardHash"` BestShardHeight map[byte]uint64 `json:"BestShardHeight"` Epoch uint64 `json:"Epoch"` BeaconHeight uint64 `json:"BeaconHeight"` BeaconProposerIndex int `json:"BeaconProposerIndex"` BeaconCommittee []string `json:"BeaconCommittee"` BeaconPendingValidator []string `json:"BeaconPendingValidator"` CandidateShardWaitingForCurrentRandom []string `json:"CandidateShardWaitingForCurrentRandom"` // snapshot shard candidate list, waiting to be shuffled in this current epoch CandidateBeaconWaitingForCurrentRandom []string `json:"CandidateBeaconWaitingForCurrentRandom"` CandidateShardWaitingForNextRandom []string `json:"CandidateShardWaitingForNextRandom"` // shard candidate list, waiting to be shuffled in next epoch CandidateBeaconWaitingForNextRandom []string `json:"CandidateBeaconWaitingForNextRandom"` RewardReceiver map[string]string `json:"RewardReceiver"` // key: incognito public key of committee, value: payment address reward receiver ShardCommittee map[byte][]string `json:"ShardCommittee"` // current committee and validator of all shard ShardPendingValidator map[byte][]string `json:"ShardPendingValidator"` // pending candidate waiting for swap to get in committee of all shard AutoStaking map[string]bool `json:"AutoStaking"` StakingTx map[string]common.Hash `json:"StakingTx"` CurrentRandomNumber int64 `json:"CurrentRandomNumber"` CurrentRandomTimeStamp int64 `json:"CurrentRandomTimeStamp"` // random timestamp for this epoch IsGetRandomNumber bool `json:"IsGetRandomNumber"` MaxBeaconCommitteeSize int `json:"MaxBeaconCommitteeSize"` MinBeaconCommitteeSize int `json:"MinBeaconCommitteeSize"` MaxShardCommitteeSize int `json:"MaxShardCommitteeSize"` MinShardCommitteeSize int `json:"MinShardCommitteeSize"` ActiveShards int `json:"ActiveShards"` LastCrossShardState map[byte]map[byte]uint64 `json:"LastCrossShardState"` ShardHandle map[byte]bool `json:"ShardHandle"` // lock sync.RWMutex CommitteeEngineVersion uint `json:"CommitteeEngineVersion"` NumberOfMissingSignature map[string]MissingSignature `json:"MissingSignature"` // lock sync.RWMutex MissingSignaturePenalty map[string]Penalty `json:"MissingSignaturePenalty"` // lock sync.RWMutex }
BeaconBestState describes the best state of the beacon chain.
type BestBlockItem ¶
type BestBlockItem struct { Height uint64 `json:"Height"` Hash string `json:"Hash"` TotalTxs uint64 `json:"TotalTxs"` BlockProducer string `json:"BlockProducer"` ValidationData string `json:"ValidationData"` Epoch uint64 `json:"Epoch"` Time int64 `json:"Time"` RemainingBlockEpoch uint64 `json:"RemainingBlockEpoch"` EpochBlock uint64 `json:"EpochBlock"` }
BestBlockItem describes the information of a best block.
type BestBlockResult ¶
type BestBlockResult struct {
BestBlocks map[int]BestBlockItem `json:"BestBlocks"`
}
BestBlockResult represents the best block detail of each shard chain and the beacon chain.
type BlockHashResult ¶
BlockHashResult represents the best block hash of each shard chain and the beacon chain.
type BlockInfo ¶
type BlockInfo struct { Height uint64 `json:"BlockHeight"` Hash string `json:"BlockHash"` PreHash string `json:"PreHash"` }
BlockInfo consists of simplified information of a block.
type CreateTransactionResult ¶
CreateTransactionResult describes an RPC-result of creating PRV transactions.
type CreateTransactionTokenResult ¶
type CreateTransactionTokenResult struct { Base58CheckData string ShardID byte `json:"ShardID"` TxID string `json:"TxID"` TokenID string `json:"TokenID"` TokenName string `json:"TokenName"` TokenAmount uint64 `json:"TokenAmount"` }
CreateTransactionTokenResult describes an RPC-result of creating token transactions.
type CurrentPDEState ¶
type CurrentPDEState struct { WaitingPDEContributions map[string]*PDEContribution `json:"WaitingPDEContributions"` PDEPoolPairs map[string]*PoolInfo `json:"PDEPoolPairs"` PDETradingFees map[string]uint64 `json:"PDETradingFees"` BeaconTimeStamp int64 `json:"BeaconTimeStamp"` }
CurrentPDEState describes the state of the pDEX at a specific beacon height.
type ICoinInfo ¶
type ICoinInfo interface { GetVersion() uint8 GetCommitment() *crypto.Point GetInfo() []byte GetPublicKey() *crypto.Point GetValue() uint64 GetKeyImage() *crypto.Point GetRandomness() *crypto.Scalar GetShardID() (uint8, error) GetSNDerivator() *crypto.Scalar GetCoinDetailEncrypted() []byte IsEncrypted() bool GetTxRandom() *coin.TxRandom GetAssetTag() *crypto.Point MarshalJSON() ([]byte, error) UnmarshalJSON(data []byte) error Bytes() []byte SetBytes(bytes []byte) error DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point) }
ICoinInfo describes all methods of an RPC output coin.
type InstructionProof ¶
type InstructionProof struct { Instruction string // Hex-encoded swap inst BeaconHeight string // Hex encoded height of the block contains the inst BridgeHeight string BeaconInstPath []string // Hex encoded path of the inst in merkle tree BeaconInstPathIsLeft []bool // Indicate if it is the left or right node BeaconInstRoot string // Hex encoded root of the inst merkle tree BeaconBlkData string // Hex encoded hash of the block meta BeaconSigs []string // Hex encoded signature (r, s, v) BeaconSigIndices []int `json:"BeaconSigIdxs"` // Indices of signer BridgeInstPath []string BridgeInstPathIsLeft []bool BridgeInstRoot string BridgeBlkData string BridgeSigs []string BridgeSigIndices []int `json:"BridgeSigIdxs"` }
InstructionProof describes the proof of a instruction in the beacon chain.
type ListOutputCoins ¶
type ListOutputCoins struct { FromHeight uint64 `json:"FromHeight"` ToHeight uint64 `json:"ToHeight"` Outputs map[string][]OutCoin `json:"Outputs"` }
ListOutputCoins is a list of output coins returned by an RPC response.
type MiningInfoResult ¶
type MiningInfoResult struct { ShardHeight uint64 `json:"ShardHeight"` BeaconHeight uint64 `json:"BeaconHeight"` CurrentShardBlockTx int `json:"CurrentShardBlockTx"` PoolSize int `json:"PoolSize"` Chain string `json:"Chain"` ShardID int `json:"ShardID"` Layer string `json:"Layer"` Role string `json:"Role"` MiningPublicKey string `json:"MiningPublickey"` IsEnableMining bool `json:"IsEnableMining"` }
MiningInfoResult describes the mining info of a node.
type MissingSignature ¶
MissingSignature keeps track of the number of missing signatures of a BeaconBestState.
type NodePoolInfo ¶
NodePoolInfo describes the information of a node.
type OutCoin ¶
type OutCoin struct { Version string `json:"Version"` Index string `json:"Index"` PublicKey string `json:"PublicKey"` Commitment string `json:"Commitment"` CoinCommitment string `json:"CoinCommitment"` SNDerivator string `json:"SNDerivator"` KeyImage string `json:"KeyImage"` Randomness string `json:"Randomness"` Value string `json:"Value"` Info string `json:"Info"` TxRandom string `json:"TxRandom,omitempty"` CoinDetailsEncrypted string `json:"CoinDetailsEncrypted,omitempty"` AssetTag string `json:"AssetTag,omitempty"` }
OutCoin is a struct to parse raw-data returned by an RPC response into an output coin.
func NewOutCoin ¶
NewOutCoin creates a new OutCoin from the given ICoinInfo.
type PDEContribution ¶
type PDEContribution struct { ContributorAddressStr string TokenIDStr string Amount uint64 TxReqID common.Hash }
PDEContribution describes a contribution on the pDEX.
type PoolInfo ¶
type PoolInfo struct { Token1IDStr string Token1PoolValue uint64 Token2IDStr string Token2PoolValue uint64 }
PoolInfo represents a pDEX pool of two tokenIDs.
type RandomCommitmentAndPublicKeyResult ¶
type RandomCommitmentAndPublicKeyResult struct { CommitmentIndices []uint64 `json:"CommitmentIndices"` PublicKeys []string `json:"PublicKeys"` Commitments []string `json:"Commitments"` AssetTags []string `json:"AssetTags"` }
RandomCommitmentAndPublicKeyResult represents the response to a request retrieving random decoys for transactions of version 2.
type RandomCommitmentResult ¶
type RandomCommitmentResult struct { CommitmentIndices []uint64 `json:"CommitmentIndices"` MyCommitmentIndices []uint64 `json:"MyCommitmentIndexs"` Commitments []string `json:"Commitments"` }
RandomCommitmentResult represents the response to a request retrieving random decoys for transactions of version 1.
type ShardBestState ¶
type ShardBestState struct { BestBlockHash common.Hash `json:"BestBlockHash"` // hash of block. BestBeaconHash common.Hash `json:"BestBeaconHash"` BeaconHeight uint64 `json:"BeaconHeight"` ShardID byte `json:"ShardID"` Epoch uint64 `json:"Epoch"` ShardHeight uint64 `json:"ShardHeight"` MaxShardCommitteeSize int `json:"MaxShardCommitteeSize"` MinShardCommitteeSize int `json:"MinShardCommitteeSize"` ShardProposerIdx int `json:"ShardProposerIdx"` ShardCommittee []string `json:"ShardCommittee"` ShardPendingValidator []string `json:"ShardPendingValidator"` BestCrossShard map[byte]uint64 `json:"BestCrossShard"` // Best cross shard block by heigh StakingTx map[string]string `json:"StakingTx"` NumTxns uint64 `json:"NumTxns"` // The number of txns in the block. TotalTxns uint64 `json:"TotalTxns"` // The total number of txns in the chain. TotalTxnsExcludeSalary uint64 `json:"TotalTxnsExcludeSalary"` // for testing and benchmark ActiveShards int `json:"ActiveShards"` MetricBlockHeight uint64 `json:"MetricBlockHeight"` CommitteeFromBlock common.Hash `json:"CommitteeFromBlock"` CommitteeEngineVersion uint `json:"CommitteeEngineVersion"` }
ShardBestState describes the best state result of a shard.
type ShardCommitteeState ¶
type ShardCommitteeState struct { Root string `json:"root"` ShardID uint64 `json:"shardID"` Committee []string `json:"committee"` Substitute []string `json:"substitute"` }
ShardCommitteeState describes a committee state of a shard.
type SyncInfo ¶
type SyncInfo struct { IsSync bool LastInsert string BlockHeight uint64 BlockTime string BlockHash string }
SyncInfo describes the sync information of a node.
type TransactionDetail ¶
type TransactionDetail struct { BlockHash string `json:"BlockHash"` BlockHeight uint64 `json:"BlockHeight"` TxSize uint64 `json:"TxSize"` Index uint64 `json:"Index"` ShardID byte `json:"ShardID"` Hash string `json:"Hash"` Version int8 `json:"Version"` Type string `json:"Type"` // Transaction type LockTime string `json:"LockTime"` RawLockTime int64 `json:"RawLockTime,omitempty"` Fee uint64 `json:"Fee"` // Fee applies: always consant Image string `json:"Image"` IsPrivacy bool `json:"IsPrivacy"` Proof string `json:"Proof"` //ProofDetail ProofDetail `json:"ProofDetail"` InputCoinPubKey string `json:"InputCoinPubKey"` SigPubKey string `json:"SigPubKey,omitempty"` // 64 bytes RawSigPubKey []byte `json:"RawSigPubKey,omitempty"` // 64 bytes Sig string `json:"Sig,omitempty"` // 64 bytes Metadata string `json:"Metadata"` CustomTokenData string `json:"CustomTokenData"` PrivacyCustomTokenID string `json:"PrivacyCustomTokenID"` PrivacyCustomTokenName string `json:"PrivacyCustomTokenName"` PrivacyCustomTokenSymbol string `json:"PrivacyCustomTokenSymbol"` PrivacyCustomTokenData string `json:"PrivacyCustomTokenData"` //PrivacyCustomTokenProofDetail ProofDetail `json:"PrivacyCustomTokenProofDetail"` PrivacyCustomTokenIsPrivacy bool `json:"PrivacyCustomTokenIsPrivacy"` PrivacyCustomTokenFee uint64 `json:"PrivacyCustomTokenFee"` IsInMempool bool `json:"IsInMempool"` IsInBlock bool `json:"IsInBlock"` Info string `json:"Info"` }
TransactionDetail describes the detail of a transaction returned by an RPC response.