eos連接主網配置文件解析

genesis.json

  • 位于/eos_install/eos/buildeos_install文件夾下面儲存的是git下來的eos源碼)

  • 連接測試網的genesis.json文件如下

 {
  "initial_timestamp": "2018-06-01T12:00:00.000",
  "initial_key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
  "initial_configuration": {
?    "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
  }
} 
  • 我們需要修改一下才能連接到主網,連接主網的genesis.json文件如下:
{
 "initial_timestamp": "2018-06-08T08:08:08.888",
 "initial_key": "EOS7EarnUhcyYqmdnPon8rm7mBCTnBoot6o7fE2WzjvEX2TdggbL3",
 "initial_configuration": {
?    "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
 }
}
  • 如果在那個路勁找不到這個文件,就自己創(chuàng)建一個,一樣可以用

config.ini

內容如下:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" contenteditable="true" cid="n4712" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@localhost config]# vi config.ini 
?
# the endpoint upon which to listen for incoming connections (eosio::bnet_plugin)
bnet-endpoint = 0.0.0.0:4321
?
# this peer will request only irreversible blocks from other nodes (eosio::bnet_plugin)
bnet-follow-irreversible = 0
?
# the number of threads to use to process network messages (eosio::bnet_plugin)
# bnet-threads =
?
# remote endpoint of other node to connect to; Use multiple bnet-connect options as needed to compose a network (eosio::bnet_plugin)
# bnet-connect =
?
# this peer will request no pending transactions from other nodes (eosio::bnet_plugin)
bnet-no-trx = false
?
# The string used to format peers when logging messages about them.  Variables are escaped with ${<variable name>}.
# Available Variables:
#    _name      self-reported name
#
#    _id        self-reported ID (Public Key)
#
#    _ip        remote IP address of peer
#
#    _port      remote port number of peer
#
#    _lip       local IP address connected to peer
#
#    _lport     local port number connected to peer
#
#  (eosio::bnet_plugin)
bnet-peer-log-format = ["${_name}" ${_ip}:${_port}]
?
# the location of the blocks directory (absolute path or relative to application data dir) (eosio::chain_plugin)
blocks-dir = "blocks"
?
# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. (eosio::chain_plugin)
# checkpoint =
?
# Override default WASM runtime (eosio::chain_plugin)
# wasm-runtime =
?
# Override default maximum ABI serialization time allowed in ms (eosio::chain_plugin)
abi-serializer-max-time-ms = 15000
?
# Maximum size (in MiB) of the chain state database (eosio::chain_plugin)
chain-state-db-size-mb = 1024
?
# Safely shut down node when free space remaining in the chain state database drops below this size (in MiB). (eosio::chain_plugin)
chain-state-db-guard-size-mb = 128
?
# Maximum size (in MiB) of the reversible blocks database (eosio::chain_plugin)
reversible-blocks-db-size-mb = 340
?
# Safely shut down node when free space remaining in the reverseible blocks database drops below this size (in MiB). (eosio::chain_plugin)
reversible-blocks-db-guard-size-mb = 2
?
# print contract's output to console (eosio::chain_plugin)
contracts-console = false
?
# Account added to actor whitelist (may specify multiple times) (eosio::chain_plugin)
# actor-whitelist =
?
# Account added to actor blacklist (may specify multiple times) (eosio::chain_plugin)
# actor-blacklist =
?
# Contract account added to contract whitelist (may specify multiple times) (eosio::chain_plugin)
# contract-whitelist =
?
# Contract account added to contract blacklist (may specify multiple times) (eosio::chain_plugin)
# contract-blacklist =
?
# Action (in the form code::action) added to action blacklist (may specify multiple times) (eosio::chain_plugin)
# action-blacklist =
?
# Public key added to blacklist of keys that should not be included in authorities (may specify multiple times) (eosio::chain_plugin)
# key-blacklist =
?
# Database read mode ("speculative", "head", or "read-only").
# In "speculative" mode database contains changes done up to the head block plus changes made by transactions not yet included to the blockchain.
# In "head" mode database contains changes done up to the current head block.
# In "read-only" mode database contains incoming block changes but no speculative transaction processing.
#  (eosio::chain_plugin)
read-mode = speculative
?
# Chain validation mode ("full" or "light").
# In "full" mode all incoming blocks will be fully validated.
# In "light" mode all incoming blocks headers will be fully validated; transactions in those validated blocks will be trusted
#  (eosio::chain_plugin)
validation-mode = full
?
# Disable the check which subjectively fails a transaction if a contract bills more RAM to another account within the context of a notification handler (i.e. when the receiver is not the code of the action). (eosio::chain_plugin)
disable-ram-billing-notify-checks = false
?
# Track actions which match receiver:action:actor. Actor may be blank to include all. Action and Actor both blank allows all from Recieiver. Receiver may not be blank. (eosio::history_plugin)
# filter-on =
?
# Do not track actions which match receiver:action:actor. Action and Actor both blank excludes all from Reciever. Actor blank excludes all from reciever:action. Receiver may not be blank. (eosio::history_plugin)
# filter-out =
?
# PEM encoded trusted root certificate (or path to file containing one) used to validate any TLS connections made.  (may specify multiple times)
#  (eosio::http_client_plugin)
# https-client-root-cert =
?
# true: validate that the peer certificates are valid and trusted, false: ignore cert errors (eosio::http_client_plugin)
https-client-validate-peers = 1
?
# The local IP and port to listen for incoming http connections; set blank to disable. (eosio::http_plugin)
http-server-address = 127.0.0.1:8888
?
# The local IP and port to listen for incoming https connections; leave blank to disable. (eosio::http_plugin)
# https-server-address =
?
# Filename with the certificate chain to present on https connections. PEM format. Required for https. (eosio::http_plugin)
# https-certificate-chain-file =
?
# Filename with https private key in PEM format. Required for https (eosio::http_plugin)
# https-private-key-file =
?
# Specify the Access-Control-Allow-Origin to be returned on each request. (eosio::http_plugin)
# access-control-allow-origin =
?
# Specify the Access-Control-Allow-Headers to be returned on each request. (eosio::http_plugin)
# access-control-allow-headers =
?
# Specify the Access-Control-Max-Age to be returned on each request. (eosio::http_plugin)
# access-control-max-age =
?
# Specify if Access-Control-Allow-Credentials: true should be returned on each request. (eosio::http_plugin)
access-control-allow-credentials = false
?
# The maximum body size in bytes allowed for incoming RPC requests (eosio::http_plugin)
max-body-size = 1048576
?
# Append the error log to HTTP responses (eosio::http_plugin)
verbose-http-errors = false
?
# If set to false, then any incoming "Host" header is considered valid (eosio::http_plugin)
http-validate-host = 1
?
# Additionaly acceptable values for the "Host" header of incoming HTTP requests, can be specified multiple times.  Includes http/s_server_address by default. (eosio::http_plugin)
# http-alias =
?
# The maximum number of pending login requests (eosio::login_plugin)
max-login-requests = 1000000
?
# The maximum timeout for pending login requests (in seconds) (eosio::login_plugin)
max-login-timeout = 60
?
# The target queue size between nodeos and MongoDB plugin thread. (eosio::mongo_db_plugin)
mongodb-queue-size = 1024
?
# The maximum size of the abi cache for serializing data. (eosio::mongo_db_plugin)
mongodb-abi-cache-size = 2048
?
# Required with --replay-blockchain, --hard-replay-blockchain, or --delete-all-blocks to wipe mongo db.This option required to prevent accidental wipe of mongo db. (eosio::mongo_db_plugin)
mongodb-wipe = false
?
# If specified then only abi data pushed to mongodb until specified block is reached. (eosio::mongo_db_plugin)
mongodb-block-start = 0
?
# MongoDB URI connection string, see: https://docs.mongodb.com/master/reference/connection-string/. If not specified then plugin is disabled. Default database 'EOS' is used if not specified in URI. Example: mongodb://127.0.0.1:27017/EOS (eosio::mongo_db_plugin)
# mongodb-uri =
?
# Enables storing blocks in mongodb. (eosio::mongo_db_plugin)
mongodb-store-blocks = 1
?
# Enables storing block state in mongodb. (eosio::mongo_db_plugin)
mongodb-store-block-states = 1
?
# Enables storing transactions in mongodb. (eosio::mongo_db_plugin)
mongodb-store-transactions = 1
?
# Enables storing transaction traces in mongodb. (eosio::mongo_db_plugin)
mongodb-store-transaction-traces = 1
?
# Enables storing action traces in mongodb. (eosio::mongo_db_plugin)
mongodb-store-action-traces = 1
?
# Track actions which match receiver:action:actor. Receiver, Action, & Actor may be blank to include all. i.e. eosio:: or :transfer:  Use * or leave unspecified to include all. (eosio::mongo_db_plugin)
# mongodb-filter-on =
?
# Do not track actions which match receiver:action:actor. Receiver, Action, & Actor may be blank to exclude all. (eosio::mongo_db_plugin)
# mongodb-filter-out =
?
# The actual host:port used to listen for incoming p2p connections. (eosio::net_plugin)
p2p-listen-endpoint = 0.0.0.0:9876
?
# An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint. (eosio::net_plugin)
# p2p-server-address =
?
# The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network. (eosio::net_plugin)
# p2p-peer-address =
?
# Maximum number of client nodes from any single IP address (eosio::net_plugin)
p2p-max-nodes-per-host = 1
?
# The name supplied to identify this node amongst the peers. (eosio::net_plugin)
agent-name = "EOS Test Agent"
?
# Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined. (eosio::net_plugin)
allowed-connection = any
?
# Optional public key of peer allowed to connect.  May be used multiple times. (eosio::net_plugin)
# peer-key =
?
# Tuple of [PublicKey, WIF private key] (may specify multiple times) (eosio::net_plugin)
# peer-private-key =
?
# Maximum number of clients from which connections are accepted, use 0 for no limit (eosio::net_plugin)
max-clients = 25
?
# number of seconds to wait before cleaning up dead connections (eosio::net_plugin)
connection-cleanup-period = 30
?
# max connection cleanup time per cleanup call in millisec (eosio::net_plugin)
max-cleanup-time-msec = 10
?
# True to require exact match of peer network version. (eosio::net_plugin)
network-version-match = 0
?
# number of blocks to retrieve in a chunk from any individual peer during synchronization (eosio::net_plugin)
sync-fetch-span = 100
?
# maximum sizes of transaction or block messages that are sent without first sending a notice (eosio::net_plugin)
max-implicit-request = 1500
?
# Enable expirimental socket read watermark optimization (eosio::net_plugin)
use-socket-read-watermark = 0
?
# The string used to format peers when logging messages about them.  Variables are escaped with ${<variable name>}.
# Available Variables:
#    _name      self-reported name
#
#    _id        self-reported ID (64 hex characters)
#
#    _sid       first 8 characters of _peer.id
#
#    _ip        remote IP address of peer
#
#    _port      remote port number of peer
#
#    _lip       local IP address connected to peer
#
#    _lport     local port number connected to peer
#
#  (eosio::net_plugin)
peer-log-format = ["${_name}" ${_ip}:${_port}]
?
# Enable block production, even if the chain is stale. (eosio::producer_plugin)
enable-stale-production = false
?
# Start this node in a state where production is paused (eosio::producer_plugin)
pause-on-startup = false
?
# Limits the maximum time (in milliseconds) that is allowed a pushed transaction's code to execute before being considered invalid (eosio::producer_plugin)
max-transaction-time = 30
?
# Limits the maximum age (in seconds) of the DPOS Irreversible Block for a chain this node will produce blocks on (use negative value to indicate unlimited) (eosio::producer_plugin)
max-irreversible-block-age = -1
?
# ID of producer controlled by this node (e.g. inita; may specify multiple times) (eosio::producer_plugin)
# producer-name =
?
# (DEPRECATED - Use signature-provider instead) Tuple of [public key, WIF private key] (may specify multiple times) (eosio::producer_plugin)
# private-key =
?
# Key=Value pairs in the form <public-key>=<provider-spec>
# Where:
#    <public-key>       is a string form of a vaild EOSIO public key
#
#    <provider-spec>    is a string in the form <provider-type>:<data>
#
#    <provider-type>    is KEY, or KEOSD
#
#    KEY:<data>         is a string form of a valid EOSIO private key which maps to the provided public key
#
#    KEOSD:<data>       is the URL where keosd is available and the approptiate wallet(s) are unlocked (eosio::producer_plugin)
signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
?
# Limits the maximum time (in milliseconds) that is allowd for sending blocks to a keosd provider for signing (eosio::producer_plugin)
keosd-provider-timeout = 5
?
# account that can not access to extended CPU/NET virtual resources (eosio::producer_plugin)
# greylist-account =
?
# offset of non last block producing time in micro second. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later (eosio::producer_plugin)
produce-time-offset-us = 0
?
# offset of last block producing time in micro second. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later (eosio::producer_plugin)
last-block-time-offset-us = 0
?
# ratio between incoming transations and deferred transactions when both are exhausted (eosio::producer_plugin)
incoming-defer-ratio = 1
?
# Lag in number of blocks from the head block when selecting the reference block for transactions (-1 means Last Irreversible Block) (eosio::txn_test_gen_plugin)
txn-reference-block-lag = 0
?
# Plugin(s) to enable, may be specified multiple times
# plugin =</pre>

連接主網需要修改該配置文件

  • # p2p-server-address =改成p2p-server-address =0.0.0.0:9876,主網連接需要從別的節(jié)點同步數據

  • chain-state-db-size-mb = 10240,默認的1024太小了,很快就會滿

  • plugin = eosio::chain_api_plugin ? plugin = eosio::history_plugin ? plugin = eosio::history_api_plugin ? plugin = eosio::chain_plugin ? plugin = eosio::bnet_plugin

    網上可以找到的一些老教程里面可能還包含了wallet的插件,實測不需要,如果裝了反而跑不起來

  • 還需要把節(jié)點加進來,這里是一份所有節(jié)點的清單,這里是份標準的config.ini模板可供參考。實測peer的多少并不能對同步區(qū)塊的速度造成很大的影響,少一點多一點無所謂。

啟動nodeos連接主網

下面是幾種啟動nodeos的常用方式,但是不建議試用

  • ./nodeos:只能在nodeos所在的位置啟動,./表示當前文件夾

  • nodeos:配置完環(huán)境變量后的啟動方式,跟上一條結果一樣,區(qū)別是在任何位置都可以用

    配置臨時環(huán)境變量的格式樣例:export PATH=$PATH:/home/eos_install/eos/build/programs/nodeos

  • ./nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin:指定了兩個插件,如果上面已經配置了config.ini就不需要再指定了

建議使用下面一條命令啟動nodeos

  • nodeos --data-dir=/home/eos_install/eos/data/packages/nodeos --config-dir=/home/eos_install/eos/data/packages/nodeos--data-dir指定了data的存儲位置,也就是block的位置,--config-dir指定了config.ini的位置,如果是第一次啟動的話,可以在后面加上--genesis-json genesis.json指定genesis.josn文件位置。
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 227,797評論 6 531
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 98,179評論 3 414
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 175,628評論 0 373
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 62,642評論 1 309
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 71,444評論 6 405
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 54,948評論 1 321
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,040評論 3 440
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,185評論 0 287
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發(fā)現(xiàn)了一具尸體,經...
    沈念sama閱讀 48,717評論 1 333
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 40,602評論 3 354
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 42,794評論 1 369
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,316評論 5 358
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 44,045評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,418評論 0 26
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 35,671評論 1 281
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,414評論 3 390
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 47,750評論 2 370

推薦閱讀更多精彩內容