配置前
参数说明:
配置变量在 EOS项目的include/eosio/chain/chain_config.hpp文件中
*
* This object stores the blockchain configuration, which is set by the block producers. Block producers each vote for
* their preference for each of the parameters in this object, and the blockchain runs according to the median of the
* values specified by the producers.
*/
struct chain_config {
uint64_t max_block_net_usage; ///< the maxiumum net usage in instructions for a block
uint32_t target_block_net_usage_pct; ///< the target percent (1% == 100, 100%= 10,000) of maximum net usage; exceeding this triggers congestion handling
uint32_t max_transaction_net_usage; ///< the maximum objectively measured net usage that the chain will allow regardless of account limits
uint32_t base_per_transaction_net_usage; ///< the base amount of net usage billed for a transaction to cover incidentals
uint32_t net_usage_leeway;
uint32_t context_free_discount_net_usage_num; ///< the numerator for the discount on net usage of context-free data
uint32_t context_free_discount_net_usage_den; ///< the denominator for the discount on net usage of context-free data
uint32_t max_block_cpu_usage; ///< the maxiumum billable cpu usage (in microseconds) for a block
uint32_t target_block_cpu_usage_pct; ///< the target percent (1% == 100, 100%= 10,000) of maximum cpu usage; exceeding this triggers congestion handling
uint32_t max_transaction_cpu_usage; ///< the maximum billable cpu usage (in microseconds) that the chain will allow regardless of account limits
uint32_t min_transaction_cpu_usage; ///< the minimum billable cpu usage (in microseconds) that the chain requires
uint32_t max_transaction_lifetime; ///< the maximum number of seconds that an input transaction's expiration can be ahead of the time of the block in which it is first included
uint32_t deferred_trx_expiration_window; ///< the number of seconds after the time a deferred transaction can first execute until it expires
uint32_t max_transaction_delay; ///< the maximum number of seconds that can be imposed as a delay requirement by authorization checks
uint32_t max_inline_action_size; ///< maximum allowed size (in bytes) of an inline action
uint16_t max_inline_action_depth; ///< recursion depth limit on sending inline actions
uint16_t max_authority_depth; ///< recursion depth limit for checking if an authority is satisfied
...
}
配置可从eosio账户的global表中查到
root@nodeosd:/# cleos get table eosio eosio global
{
"rows": [{
//---------------------------------------
//<<<<<<<<这些配置可通过eosio:setparams action来修改
"max_block_net_usage": 1048576,
"target_block_net_usage_pct": 1000,
"max_transaction_net_usage": 524288,
"base_per_transaction_net_usage": 12,
"net_usage_leeway": 500,
"context_free_discount_net_usage_num": 20,
"context_free_discount_net_usage_den": 100,
"max_block_cpu_usage": 200000,
"target_block_cpu_usage_pct": 1000,
"max_transaction_cpu_usage": 150000,
"min_transaction_cpu_usage": 100,
"max_transaction_lifetime": 3600,
"deferred_trx_expiration_window": 600,
"max_transaction_delay": 3888000,
"max_inline_action_size": 4096,
"max_inline_action_depth": 4,
"max_authority_depth": 6,
//>>>>>>>>>
//-------------------------------------------
"max_ram_size": "68719476736",
"total_ram_bytes_reserved": 509426,
"total_ram_stake": 74132,
"last_producer_schedule_update": "2020-12-15T04:10:57.500",
"last_pervote_bucket_fill": "2020-09-18T03:39:26.000",
"pervote_bucket": 0,
"perblock_bucket": 0,
"total_unpaid_blocks": 0,
"total_activated_stake": 0,
"thresh_activated_stake_time": "2020-09-18T03:39:26.000",
"last_producer_schedule_size": 0,
"total_producer_vote_weight": "0.00000000000000000",
"last_name_close": "2000-01-01T00:00:00.000"
}
],
"more": false
}
配置
使用eosio:setparams来修改链配置。可配置的参数如下:
root@nodeosd:/# echo '
> { "params":
> {
> "max_block_net_usage": 1048577,
> "target_block_net_usage_pct": 1000,
> "max_transaction_net_usage": 524288,
> "base_per_transaction_net_usage": 12,
> "net_usage_leeway": 500,
> "context_free_discount_net_usage_num": 20,
> "context_free_discount_net_usage_den": 100,
> "max_block_cpu_usage": 200000,
> "target_block_cpu_usage_pct": 1000,
> "max_transaction_cpu_usage": 150000,
> "min_transaction_cpu_usage": 100,
> "max_transaction_lifetime": 3600,
> "deferred_trx_expiration_window": 600,
> "max_transaction_delay": 3888000,
> "max_inline_action_size": 4096,
> "max_inline_action_depth": 4,
> "max_authority_depth": 6
> }
> }' | tr -d ' \r\n' > t
root@nodeosd:/# cleos --wallet-url http://123.206.41.161:8900 push action eosio setparams `cat t` -p eosio
executed transaction: e79b445b1ca4003e374f96a6291ccfb7c864c0372e9ebe1c99674439dbe86923 160 bytes 332 us
# eosio <= eosio::setparams {"params":{"max_block_net_usage":1048577,"target_block_net_usage_pct":1000,"max_transaction_net_usag...
warning: transaction executed locally, but may not be confirmed by the network yet
配置发生变化
root@nodeosd:/# cleos get table eosio eosio global
{
"rows": [{
"max_block_net_usage": 1048577, //1048577 --> 1048576
"target_block_net_usage_pct": 1000,
"max_transaction_net_usage": 524288,
"base_per_transaction_net_usage": 12,
"net_usage_leeway": 500,
"context_free_discount_net_usage_num": 20,
"context_free_discount_net_usage_den": 100,
"max_block_cpu_usage": 200000,
"target_block_cpu_usage_pct": 1000,
"max_transaction_cpu_usage": 150000,
"min_transaction_cpu_usage": 100,
"max_transaction_lifetime": 3600,
"deferred_trx_expiration_window": 600,
"max_transaction_delay": 3888000,
"max_inline_action_size": 4096,
"max_inline_action_depth": 4,
"max_authority_depth": 6,
"max_ram_size": "68719476736",
"total_ram_bytes_reserved": 509426,
"total_ram_stake": 74132,
"last_producer_schedule_update": "2020-12-15T04:11:58.000",
"last_pervote_bucket_fill": "2020-09-18T03:39:26.000",
"pervote_bucket": 0,
"perblock_bucket": 0,
"total_unpaid_blocks": 0,
"total_activated_stake": 0,
"thresh_activated_stake_time": "2020-09-18T03:39:26.000",
"last_producer_schedule_size": 0,
"total_producer_vote_weight": "0.00000000000000000",
"last_name_close": "2000-01-01T00:00:00.000"
}
],
"more": false
}