- 第 1 章 区块链
- 第 2 章 以太坊
- 第 3 章 以太坊私链入门
- 第 4 章 以太坊网络
- 第 5 章 geth v1.8.16 命令详解
- 第 6 章 Wallet
- 第 7 章 Token
- 第 8 章 智能合约语言 Solidity v0.5.0
- 第 9 章 Truffle v4.1.8 开发框架
- 第 10 章 web3.js - 1.0.0
- 第 11 章 web3j v3.4.0 - Jave Client
- 11.2. 启动以太坊
- 11.3. Maven pom.xml 文件
- 11.4. Java 与 Solidity 数据类型映射关系
- 11.5. 常量
- 11.6. 连接到服务器获取版本号
- 11.7. 获得以太坊状态信息
- 11.8. 单位转换
- 11.9. 账号管理
- 11.10. Credentials
- 11.11. 交易
- 11.12. 钱包
- 11.13. 智能合约
- 11.14. ERC20合约
- 11.15. Infura
- 11.16. 助记词
- 11.17. 过滤器 (Filter)
- 11.18. Subscription
- 11.19. 解锁账号
- 11.20. IBAN (International Bank Account Number)
- 11.21. Springboot with Ethereum (web3j)
- 第 12 章 web3.py - A python interface for interacting with the Ethereum blockchain and ecosystem.
- 第 14 章 Ethereum Developer APIs
- 第 15 章 infura
- 第 16 章 以太坊案例
- 第 17 章 FAQ
- 17.3. Error: authentication needed: password or unlock
- 17.4. 新增节点后不生效
- 17.5. Unhandled rejection Error: Returned error: The method personal_unlockAccount does not exist/is not available
- 17.6. Error: exceeds block gas limit
- 17.7. Migrations.sol:11:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(…) { … }" instead.
- 17.8. Exception in thread "main" rx.exceptions.OnErrorNotImplementedException: Invalid response received: okhttp3.internal.http.RealResponseBody@6c25e6c4
- 17.9. 旧版本 Remix(browser-solidity) 本地安装
- 第 18 章 Hyperledger Fabric v2.0.0
- 第 19 章 Hyperledger Fabric 运维
- 第 20 章 Chaincode 链码(智能合约)
- 第 21 章 Hyperledger Fabric Client SDK for Node.js
- 第 22 章 fabric-sdk-java
- 第 24 章 已知 Hyperledger 落地案例
- 第 25 章 Fabric Command
- 第 26 章 Fabric FAQ
- 第 27 章 IPFS(InterPlanetary File System,星际文件系统)
- 第 28 章 IPFS 命令
- 第 29 章 IPFS WebUI
- 第 30 章 IPFS 集群配置
- 第 31 章 IPFS API
- 第 32 章 IPFS Faq
- 第 33 章 EOS
- 第 34 章 EOS 安装
- 第 35 章 CLEOS
- 第 36 章 智能合约开发
- 第 37 章 EOS Dapp 开发
- 第 38 章 FAQ
- 第 39 章 BaaS (Blockchain as a Service) 平台
- 第 40 章 BitCoin
- 第 41 章 其他区块链相关
- 附录 1. 附录
34.6. 启动 EOS 节点
34.6. 启动 EOS 节点
34.6.1. EOS 本地网
34.6.1.1. 单节点私链
这种模式一般用于合约开发,学习和测试
nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --plugin eosio::wallet_api_plugin
区块数据保存在 ~/.local/share/eosio/nodeos/data
[root@netkiller ~]# find ~/.local/share/eosio/nodeos/data /root/.local/share/eosio/nodeos/data /root/.local/share/eosio/nodeos/data/blocks /root/.local/share/eosio/nodeos/data/blocks/blocks.index /root/.local/share/eosio/nodeos/data/blocks/reversible /root/.local/share/eosio/nodeos/data/blocks/reversible/shared_memory.meta /root/.local/share/eosio/nodeos/data/blocks/reversible/shared_memory.bin /root/.local/share/eosio/nodeos/data/blocks/blocks.log /root/.local/share/eosio/nodeos/data/state /root/.local/share/eosio/nodeos/data/state/shared_memory.meta /root/.local/share/eosio/nodeos/data/state/shared_memory.bin
本地私链会提示 warning: transaction executed locally, but may not be confirmed by the network yet.
34.6.1.2. 单机多节点
https://github.com/EOSIO/eos/wiki/Testnet-Single-Host-Multinode
EOS 有三个模块组成分别是nodeos,keosd,和cleos。nodeos 是节点进程,keosd 是钱包服务,cleos 是命令行接口。实现单机多节点主要工作在于怎样配置 nodeos 进程,使其端口不冲突。
34.6.1.3. 多机多节点
多级多节点配置只需要将其他节点的IP加入到 p2p-peer-address 池中即可,配置项涉及一下:
[root@iZj6c39y62jl5b1wmfv6u8Z config]# grep -v "^#" ~/.local/share/eosio/nodeos/config/config.ini | grep -v "^$" p2p-peer-address = node1:9876 ... ... p2p-peer-address = node(n):9876 agent-name: 改成你自己的标识, 域名或其他. producer-name: 节点账户名(12位[12345a-z]字符串). signature-provider: 你的密钥对.
准备几台服务器或者云主机
Node1 172.16.0.10 Node2 172.16.0.20 Node3 172.16.0.30
创世区块 genesis.json
{ "initial_timestamp": "2018-06-01T00:00:00.000", "initial_key": "EOS69EZcBVwgRz3AbHheR3ZpeHtaoHAPyLXfvmsiqYMAtazN3WdiL", "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": 100000, "target_block_cpu_usage_pct": 500, "max_transaction_cpu_usage": 50000, "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_generated_transaction_count": 16 }, "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000" }
34.6.1.3.1. 节点一
编辑配置文件 ~/.local/share/eosio/nodeos/config/config.ini
p2p-peer-address = 172.16.0.20:9876 p2p-peer-address = 172.16.0.30:9876 agent-name = "EOS Test Agent - Node 1" producer-name = eosio signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
启动 nodeos 进程
nodeos --genesis-json genesis.json
34.6.1.3.2. 节点二
编辑配置文件 ~/.local/share/eosio/nodeos/config/config.ini
p2p-peer-address = 172.16.0.10:9876 p2p-peer-address = 172.16.0.30:9876 agent-name = "EOS Test Agent - Node 2" producer-name = eosio signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
启动 nodeos 进程
34.6.1.3.3. 节点三
编辑配置文件 ~/.local/share/eosio/nodeos/config/config.ini
p2p-peer-address = 172.16.0.10:9876 p2p-peer-address = 172.16.0.20:9876 agent-name = "EOS Test Agent - Node 3" producer-name = eosio signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
启动 nodeos 进程
34.6.1.3.4. 进入 Node 1 创建钱包和部署合约
cleos wallet create cleos wallet unlock # 导入eosio账户的私钥到钱包,signature-provider 中的 KEY:是私钥 cleos wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 cleos create key cleos create account eosio eosio.token <公钥> <公钥> cleos set contract eosio /usr/local/src/eos/build/contracts/eosio.bios -p eosio # 发布eosio.token合约 cleos set contract eosio.token /usr/local/src/eos/build/contracts/eosio.token # 创建和发布代币 cleos push action eosio.token create '["eosio","1000000000.0000 EOS",0,0,0]' -p eosio.token cleos push action eosio.token issue '["eosio","1000000000.0000 EOS","issue"]' -p eosio # 查询代币数量 cleos get currency balance eosio.token eosio # 部署eosio.system合约 cleos set contract eosio /usr/local/src/eos/build/contracts/eosio.system # 创建账号 cleos create key cleos system newaccount eosio test <公钥> <公钥> --stake-net '50.00 EOS' --stake-cpu '50.00 EOS' # 登录 Node 2 注册成为 bp cleos system regproducer test <公钥> http://127.0.0.1:8888 # 给创建的账户转账 cleos push action eosio.token transfer '["eosio", "test","100000000.0000 EOS","vote"]' -p eosio # 锁定代币 cleos system delegatebw test test '25000000.0000 EOS' '25000000.0000 EOS' --transfer # 给出块节点投票 cleos system voteproducer prods test test
34.6.2. 测试网
34.6.2.1. Public Testnet Endpoints(公共测试网络的接入点)
34.6.2.1.1. testnet1.eos.io
HTTP Endpoint: testnet1.eos.io P2P Endpoint: p2p-testnet1.eos.io:9876 Web Wallet Endpoint: t1wallet.eos.io, t1api.eos.io, t1readonly.eos.io $ curl testnet1.eos.io/v1/chain/get_info
34.6.2.1.2. http://testnet.eoswtz.com
http://www.eoswtz.com
34.6.2.2. 本地连接到测试网
修改config.ini文件
p2p-peer-address = p2p-testnet1.eos.io block-interval-seconds = 2
34.6.2.3. EOS (testnet) Explorer (Dawn 2.0)
http://eosmonitor.info
34.6.2.4. EOS Jungle Testnet Monitor (Dawn 4.0)
34.6.3. 主网
34.6.3.1. 创世区块
https://github.com/EOS-Mainnet/eos/blob/mainnet-1.0.7/mainnet-genesis.json
34.6.3.2. eosnodes.privex.io
https://eosnodes.privex.io
[root@netkiller build]# cleos -u http://api.eosnewyork.io get info { "server_version": "1509de21", "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", "head_block_num": 3185805, "last_irreversible_block_num": 3185470, "last_irreversible_block_id": "00309b3e25263b1f6cef6a87a304284afcc06bacd1290e6904760395e07d2321", "head_block_id": "00309c8d9f01ba0ac66bd577cdfdd4e85162ba1d68e18f5660356bc8207615b1", "head_block_time": "2018-06-29T02:46:41.000", "head_block_producer": "eosisgravity", "virtual_block_cpu_limit": 200000000, "virtual_block_net_limit": 1048576000, "block_cpu_limit": 198989, "block_net_limit": 1048304 }
34.6.3.2.1. 创世区块
https://eosnodes.privex.io/static/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 } }
检查创世区块配置是否正确
[root@netkiller build]# cleos -u http://api.eosnewyork.io get info { "server_version": "1509de21", "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", "head_block_num": 3185805, "last_irreversible_block_num": 3185470, "last_irreversible_block_id": "00309b3e25263b1f6cef6a87a304284afcc06bacd1290e6904760395e07d2321", "head_block_id": "00309c8d9f01ba0ac66bd577cdfdd4e85162ba1d68e18f5660356bc8207615b1", "head_block_time": "2018-06-29T02:46:41.000", "head_block_producer": "eosisgravity", "virtual_block_cpu_limit": 200000000, "virtual_block_net_limit": 1048576000, "block_cpu_limit": 198989, "block_net_limit": 1048304 } [root@netkiller build]# cleos get info { "server_version": "90fefdd1", "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f", "head_block_num": 26364, "last_irreversible_block_num": 26363, "last_irreversible_block_id": "000066fbb919e9e7613765190b7e2e6639588d36e834da77ab63f7cc43d04ec2", "head_block_id": "000066fc54c27265bb243a3ef19923a54b52ab1cb568e067fb2f83ebcf9d1d26", "head_block_time": "2018-06-29T02:46:56.000", "head_block_producer": "eosio", "virtual_block_cpu_limit": 200000000, "virtual_block_net_limit": 1048576000, "block_cpu_limit": 199900, "block_net_limit": 1048576 }
对比两次 chain_id 是否一致,一致表示配置正确。
34.6.3.2.2. 主网超级节点
https://eosnodes.privex.io/?config=1
p2p-peer-address = 106.10.42.238:9876 p2p-peer-address = 123.59.116.52:49876 p2p-peer-address = 13.230.91.225:9865 p2p-peer-address = 130.211.59.178:9876 p2p-peer-address = 159.65.214.150:9876 p2p-peer-address = 173.242.25.101:7115 p2p-peer-address = 178.49.174.48:9876 p2p-peer-address = 18.191.33.148:59876 p2p-peer-address = 185.253.188.1:19876 p2p-peer-address = 185.253.188.1:19877 p2p-peer-address = 195.43.95.98:9876 p2p-peer-address = 34.252.209.121:5556 p2p-peer-address = 35.197.190.234:19878 p2p-peer-address = 40.114.68.16:9876 p2p-peer-address = 54.153.59.31:9999 p2p-peer-address = 807534da.eosnodeone.io:19872 p2p-peer-address = 94.130.250.22:9806 p2p-peer-address = api-full1.eoseoul.io:9876 p2p-peer-address = api-full2.eoseoul.io:9876 p2p-peer-address = api.eosuk.io:12000 p2p-peer-address = boot.eostitan.com:9876 p2p-peer-address = bp.antpool.com:443 p2p-peer-address = bp.cryptolions.io:9876 p2p-peer-address = bp.eosbeijing.one:8080 p2p-peer-address = bp.eosmedi.com:9877 p2p-peer-address = bp.libertyblock.io:9800 p2p-peer-address = dc1.eosemerge.io:9876 p2p-peer-address = dns1-p2p.oraclechain.io:49876 p2p-peer-address = eno.eosvan.io:19866 p2p-peer-address = eos-seed-de.privex.io:9876 p2p-peer-address = eos.infinitystones.io:9876 p2p-peer-address = eos.nodepacific.com:9876 p2p-peer-address = eos.staked.us:9870 p2p-peer-address = eosapi.blockmatrix.network:13546 p2p-peer-address = eosboot.chainrift.com:9876 p2p-peer-address = eosbp.buildteam.io:8532 p2p-peer-address = eosbp.eosvillage.io:8181 p2p-peer-address = eosnode.fi:9888 p2p-peer-address = eu-west-nl.eosamsterdam.net:9876 p2p-peer-address = eu1.eosdac.io:49876 p2p-peer-address = fn001.eossv.org:443 p2p-peer-address = fullnode.acroeos.one:9876 p2p-peer-address = fullnode.eoslaomao.com:443 p2p-peer-address = mainnet-eos.wancloud.cloud:55576 p2p-peer-address = mainnet.eos.ren:9376 p2p-peer-address = mainnet.eosarabia.org:3571 p2p-peer-address = mainnet.eoscalgary.io:5222 p2p-peer-address = mainnet.eoseco.com:10010 p2p-peer-address = mainnet.eospay.host:19876 p2p-peer-address = mainnet.eoswz.com:8866 p2p-peer-address = mainnet2.eostaxrelief.com:9876 p2p-peer-address = mars.fnp2p.eosbixin.com:443 p2p-peer-address = node.eos.lawyer:9876 p2p-peer-address = node.eosflare.io:1883 p2p-peer-address = node.eosio.lt:9878 p2p-peer-address = node.eosmeso.io:9876 p2p-peer-address = node1.eosjapan.co.jp:9876 p2p-peer-address = node1.eosnewyork.io:6987 p2p-peer-address = node2.blockeos.io:9987 p2p-peer-address = node2.eosarmy.io:3330 p2p-peer-address = node2.eosnewyork.io:6987 p2p-peer-address = node2.eosphere.io:9876 p2p-peer-address = p.jeda.one:3322 p2p-peer-address = p2p.eos.bitspace.no:9876 p2p-peer-address = p2p.eosdetroit.io:3018 p2p-peer-address = p2p.eosholding.ca:9876 p2p-peer-address = p2p.eosio.cr:1976 p2p-peer-address = p2p.eosio.cr:5418 p2p-peer-address = p2p.genereos.io:9876 p2p-peer-address = p2p.mainnet.eosgermany.online:9876 p2p-peer-address = p2p.mainnet.eospace.io:88 p2p-peer-address = p2p.meet.one:9876 p2p-peer-address = p2p.one.eosdublin.io:9876 p2p-peer-address = p2p.saltblock.io:19876 p2p-peer-address = p2p.two.eosdublin.io:9876 p2p-peer-address = peer.blockgenicbp.com:9876 p2p-peer-address = peer.eosio.sg:9876 p2p-peer-address = peer.eosjrr.io:9876 p2p-peer-address = peer.eosn.io:9876 p2p-peer-address = peer.main.alohaeos.com:9876 p2p-peer-address = peer1.eos.csx.io:9806 p2p-peer-address = peer1.eosthu.com:8080 p2p-peer-address = peer1.mainnet.eos.store:80 p2p-peer-address = peer1.mainnet.helloeos.com.cn:80 p2p-peer-address = peer2.eos.csx.io:9806 p2p-peer-address = peer2.eosthu.com:8080 p2p-peer-address = peer2.mainnet.helloeos.com.cn:80 p2p-peer-address = peering.dutcheos.io:9876 p2p-peer-address = peering.mainnet.eoscanada.com:9876 p2p-peer-address = peering1.mainnet.eosasia.one:80 p2p-peer-address = peering2.mainnet.eosasia.one:80 p2p-peer-address = pub0.eosys.io:6637 p2p-peer-address = pub1.eostheworld.io:9876 p2p-peer-address = pub1.eosys.io:6637 p2p-peer-address = pub2.eostheworld.io:9876 p2p-peer-address = publicnode.cypherglass.com:9876 p2p-peer-address = seed1.greymass.com:9876 p2p-peer-address = seed2.greymass.com:9876
34.6.3.3. mainnet.genereos.io
[root@netkiller ~]# cleos --url=http://mainnet.genereos.io get info { "server_version": "b195012b", "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", "head_block_num": 3218632, "last_irreversible_block_num": 3218299, "last_irreversible_block_id": "00311b7b6a24585e4a1fd806f619ca075fe9c72fa0310b6ca465e91aad33999c", "head_block_id": "00311cc8bb55e1c6d2ec9c1455908545ecee293efa556c1dce444814cf891611", "head_block_time": "2018-06-29T07:20:16.000", "head_block_producer": "teamgreymass", "virtual_block_cpu_limit": 200000000, "virtual_block_net_limit": 1048576000, "block_cpu_limit": 199900, "block_net_limit": 1048576 }
34.6.3.4. mainnet.eoswz.com
[root@netkiller ~]# cleos -u http://mainnet.eoswz.com get info { "server_version": "aa351733", "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", "head_block_num": 3221149, "last_irreversible_block_num": 3220819, "last_irreversible_block_id": "003125538662bf4cdc367336daba8a8609d6b4f5edb6e8bf0189a27fa306fbde", "head_block_id": "0031269d3ee1f2b8dbc9419a9d8ac0be7024c3a072d9f178ce297dbea6cbb58e", "head_block_time": "2018-06-29T07:41:14.500", "head_block_producer": "teamgreymass", "virtual_block_cpu_limit": 200000000, "virtual_block_net_limit": 1048576000, "block_cpu_limit": 199900, "block_net_limit": 1048576 }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论