Cross Chain Transaction Verify Interface
Ethereum
a cross tx on the ethereum mainnet, the relayer which watch the ethereum will capture the tx and send the key information to the map atlas.
key info details:
type CrossTxProve struct {
Tx *TxBaseParams
Receipt *types.Receipt
Prove light.NodeList
BlockNumber uint64
TxIndex uint
}
type TxBaseParams struct {
From []byte
To []byte
Value *big.Int
}
TxParams details: cross tx metadata.
parameter | type | comment |
---|---|---|
From | []byte | the sender of the transaction,use ethereum`s common package |
To | []byte | the receiver of the transaction,use ethereum`s common package |
Value | *big.Int | transaction value |
‘CrossTxProve'.'Receipt' is a receipt of the tx from ‘"github.com/ethereum/go-ethereum/core/types"'.
// Receipt represents the results of a transaction.
type Receipt struct {
// Consensus fields: These fields are defined by the Yellow Paper
Type uint8 `json:"type,omitempty"`
PostState []byte `json:"root"`
Status uint64 `json:"status"`
CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"`
Bloom Bloom `json:"logsBloom" gencodec:"required"`
Logs []*Log `json:"logs" gencodec:"required"`
// Implementation fields: These fields are added by geth when processing a transaction.
// They are stored in the chain database.
TxHash common.Hash `json:"transactionHash" gencodec:"required"`
ContractAddress common.Address `json:"contractAddress"`
GasUsed uint64 `json:"gasUsed" gencodec:"required"`
// Inclusion information: These fields provide information about the inclusion of the
// transaction corresponding to this receipt.
BlockHash common.Hash `json:"blockHash,omitempty"`
BlockNumber *big.Int `json:"blockNumber,omitempty"`
TransactionIndex uint `json:"transactionIndex"`
}
‘CrossTxProve'.'Prove' is a prove generated by the MPT tree composed of receipts of all transactions in the block. the type of ‘Prove' used in ‘"github.com/ethereum/go-ethereum/light"'
// NodeSet stores a set of trie nodes. It implements trie.Database and can also
// act as a cache for another trie.Database.
type NodeSet struct {
nodes map[string][]byte
order []string
dataSize int
lock sync.RWMutex
}
// NewNodeSet creates an empty node set
func NewNodeSet() *NodeSet {
return &NodeSet{
nodes: make(map[string][]byte),
}
}
// NodeList converts the node set to a NodeList
func (db *NodeSet) NodeList() NodeList {
db.lock.RLock()
defer db.lock.RUnlock()
var values NodeList
for _, key := range db.order {
values = append(values, db.nodes[key])
}
return values
}
‘CrossTxProve'.'TxIndex' the index of the current transaction in the block transaction list.
‘CrossTxProve'.'BlockNumber' the block to which the current transaction belongs.