Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountID ¶
type AccountID string
AccountID represents an account id that is used to sign transactions and is associated with transactions on the blockchain.
func ToAccountID ¶
ToAccountID converts a hex-encoded string to an account and validates the hex-encoded string is formatted correctly.
func (AccountID) IsAccountID ¶
IsAccountID verifies whether the underlying data represents a valid hex-encoded account.
type Block ¶
type Block struct { Header BlockHeader MerkleTree *merkle.Tree[BlockTx] }
Block represents a group of transactions batched together.
type BlockData ¶
type BlockData struct { Hash string `json:"hash"` Header BlockHeader `json:"block"` Trans []BlockTx `json:"trans"` }
BlockData represents what can be serialized to disk and over the network.
type BlockHeader ¶
type BlockHeader struct { Number uint64 `json:"number"` PrevBlockHash string `json:"prev_block_hash"` TimeStamp uint64 `json:"timestamp"` BeneficiaryID AccountID `json:"beneficiary"` Difficulty uint16 `json:"difficulty"` MiningReward uint64 `json:"mining_reward"` StateRoot string `json:"state_root"` TransRoot string `json:"trans_root"` Nonce uint64 `json:"nonce"` }
BlockHeader represents common information required for each block.
type BlockTx ¶
type BlockTx struct { SignedTx TimeStamp uint64 `json:"timestamp"` // Ethereum: The time the transaction was received. GasPrice uint64 `json:"gas_price"` // Ethereum: The price of one unit of gas to be paid for fees. GasUnits uint64 `json:"gas_units"` // Ethereum: The number of units of gas used for this transaction. }
BlockTx represents the transaction as it's recorded inside a block. This includes a timestamp and gas fees.
func NewBlockTx ¶
NewBlockTx constructs a new block transaction.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database manages data related to accounts who have transacted on the blockchain.
type SignedTx ¶
type SignedTx struct { Tx V *big.Int `json:"v"` // Ethereum: Recovery identifier, either 29 or 30 with sophiaID. R *big.Int `json:"r"` // Ethereum: First coordinate of the ECDSA signature. S *big.Int `json:"s"` // Ethereum: Second coordinate of the ECDSA signature. }
SignedTx is a signed version of the transaction. This is how clients like a wallet provide transactions for inclusion into the blockchain.
func (SignedTx) FromAccount ¶
FromAccount extracts the account id that signed the transaction.
func (SignedTx) SignatureString ¶
SignatureString returns the signature as a string.
type Tx ¶
type Tx struct { ChainID uint16 `json:"chain_id"` // Ethereum: The chain id that is listed in the genesis file. Nonce uint64 `json:"nonce"` // Ethereum: Unique id for the transaction supplied by the user. ToID AccountID `json:"to"` // Ethereum: Account receiving the benefit of the transaction. Value uint64 `json:"value"` // Ethereum: Monetary value received from this transaction. Tip uint64 `json:"tip"` // Ethereum: Tip offered by the sender as an incentive to mine this transaction. Data []byte `json:"data"` // Ethereum: Extra data related to the transaction. }
Tx is the transactional information between two parties.