Template Class block_t#

Nested Relationships#

Nested Types#

Class Documentation#

template<class params>
class block_t#

The block class is used to store the block information before the transaction are done. YP: H

Public Types

typedef arith_env_t<params> arith_t#

The arithmetical environment used by the arbitrary length integer library.

typedef arith_t::bn_t bn_t#

The arbitrary length integer type.

typedef cgbn_mem_t<params::BITS> evm_word_t#

The arbitrary length integer type used for the storage. It is defined as the EVM word type.

Public Functions

inline __device__ __forceinline__ block_t (arith_t arith, block_data_t *content)

The constructor of the block class.

Parameters
  • arith – The arithmetical environment

  • content – The block information content

inline __host__ block_t(arith_t arith, const cJSON *test)#

The constructor of the block class.

Parameters
  • arith – The arithmetical environment

  • test – The block information in JSON format

inline __host__ __device__ __forceinline__ ~block_t ()

The destructor of the block class.

inline __host__ void free_content ()

deallocates the block information content

inline __host__ __device__ __forceinline__ void get_coin_base (bn_t &coin_base)

Get the coin base of the block.

Parameters

coin_base[out] The coin base of the block

inline __host__ __device__ __forceinline__ void get_time_stamp (bn_t &time_stamp)

Get the time stamp of the block.

Parameters

time_stamp[out] The time stamp of the block

inline __host__ __device__ __forceinline__ void get_number (bn_t &number)

Get the number of the block.

Parameters

number[out] The number of the block

inline __host__ __device__ __forceinline__ void get_difficulty (bn_t &difficulty)

Get the difficulty of the block.

Parameters

difficulty[out] The difficulty of the block

inline __host__ __device__ __forceinline__ void get_gas_limit (bn_t &gas_limit)

Get the gas limit of the block.

Parameters

gas_limit[out] The gas limit of the block

inline __host__ __device__ __forceinline__ void get_chain_id (bn_t &chain_id)

Get the chain id of the block.

inline __host__ __device__ __forceinline__ void get_base_fee (bn_t &base_fee)

Get the base fee of the block.

Parameters

base_fee[out] The base fee of the block

inline __host__ __device__ __forceinline__ void get_previous_hash (bn_t &previous_hash, bn_t &previous_number, uint32_t &error_code)

Get the has of a previous block given by the number

Parameters
  • previous_hash[out] The hash of the previous block

  • previous_number[in] The number of the previous block

  • error_code[out] The error code

inline __host__ __device__ void print ()

Print the block information.

inline __host__ cJSON * json ()

Get the block information in JSON format.

Returns

The block information in JSON format

Public Members

block_data_t *_content#

The block information content

arith_t _arith#

The arithmetical environment

struct block_hash_t#

The previous block hash information. (YP: \(P(h, n, a)\))

Public Members

evm_word_t number#

The number of the block 0 if none

evm_word_t hash#

The hash of the block