当前位置:   article > 正文

以太坊的开发环境配置_以太坊开发环境配置

以太坊开发环境配置

目的

记录一下本人在Ubuntu环境下配置以太坊开发环境的过程,希望对后来者有所帮助。

过程

首先安装npm和NodeJS
sudo apt-get install npm
sudo apt-get install curl
<span style="color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);">curl </span><span class="hljs-attribute" style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;">-sL</span><span style="color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);"> https:</span><span class="hljs-comment" style="margin:0px;padding:0px;font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;">//deb.nodesource.com/setup_6.x | sudo -E bash -
</span><span style="color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);">sudo apt</span><span class="hljs-attribute" style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;">-get</span><span style="color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);"> install </span><span class="hljs-attribute" style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;">-y</span><span style="color:rgb(0,0,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);"> nodejs</span>
然后用npm安装solc和solc的命令行工具solc-cli
sudo npm install -g solc solc-cli --save-dev
运行命令solcjs测试是否安装成功,如果没有输出则尝试重新启动shell或者重新连SSH。

安装solc二进制包
  1. sudo add-apt-repository ppa:ethereum/ethereum
  2. sudo apt-get update
  3. sudo apt-get install solc

安装testrpc和truffle,这两个用npm就可以安装
  1. sudo npm install -g ethereumjs-testrpc
  2. sudo npm install -g truffle

测试一下
  1. root@server-01:~# testrpc
  2. EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)
  3. Available Accounts
  4. ==================
  5. (0) 0x3675e40d6bfe7566************************
  6. (1) 0x08d58806fc0594b9************************
  7. (2) 0xb03848d8e9359c13************************
  8. (3) 0xc3161063b46b2ca7************************
  9. (4) 0x026c1c6020e8bdb4************************
  10. (5) 0xe16f58c2ce883c7b************************
  11. (6) 0x77ef98fe516c2b27************************
  12. (7) 0x9ea92133dfccc26b************************
  13. (8) 0xc417d04c5c3a07fe************************
  14. (9) 0x9a2057c26ca2f31b************************
  15. Private Keys
  16. ==================
  17. (0) 7257cca8f9dedc96e5763f65b************************
  18. (1) e1e0966f65791b770f5f02889************************
  19. (2) e06e8b51551acf86911218e2b************************
  20. (3) c5c5541ff80373e67250da33f************************
  21. (4) 84fcce7aa99ae2fb2daeb3d39************************
  22. (5) b4a85007439171cb749c8a735************************
  23. (6) d915802e5ed351f580e647dd4************************
  24. (7) f968d8be8c8eca6921e096f0f************************
  25. (8) 8ad639d0ab8cba1330d0166d0************************
  26. (9) 3832604233464c554487c4638************************
  27. HD Wallet
  28. ==================
  29. Mnemonic: talent eyebrow split nasty belt crane minor tenant text exact arrow bronze
  30. Base HD Path: m/44'/60'/0'/0/{account_index}

安装Geth客户端(go-ethereum)

  1. sudo apt-get install software-properties-common
  2. sudo add-apt-repository -y ppa:ethereum/ethereum
  3. sudo apt-get update
  4. sudo apt-get install ethereum

测试一下效果

  1. root@server-01:~# geth
  2. WARN [02-07|22:25:13] No etherbase set and no accounts found as default
  3. INFO [02-07|22:25:13] Starting peer-to-peer node instance=Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9
  4. INFO [02-07|22:25:13] Allocated cache and file handles database=/root/.ethereum/geth/chaindata cache=128 handles=1024
  5. INFO [02-07|22:25:13] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 246
  6. 3000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}"
  7. INFO [02-07|22:25:13] Disk storage enabled for ethash caches dir=/root/.ethereum/geth/ethash count=3
  8. INFO [02-07|22:25:13] Disk storage enabled for ethash DAGs dir=/root/.ethash count=2
  9. INFO [02-07|22:25:13] Initialising Ethereum protocol versions="[63 62]" network=1
  10. INFO [02-07|22:25:13] Loaded most recent local header number=1689199 hash=33deb6…58ab28 td=26797004748806845550
  11. INFO [02-07|22:25:13] Loaded most recent local full block number=0 hash=d4e567…cb8fa3 td=17179869184
  12. INFO [02-07|22:25:13] Loaded most recent local fast block number=1682884 hash=3ae41f…d86991 td=26497997153318071852
  13. INFO [02-07|22:25:13] Loaded local transaction journal transactions=0 dropped=0
  14. INFO [02-07|22:25:13] Regenerated local transaction journal transactions=0 accounts=0
  15. INFO [02-07|22:25:13] Upgrading chain index type=bloombits percentage=72
  16. INFO [02-07|22:25:13] Starting P2P networking
  17. INFO [02-07|22:25:16] UDP listener up self=enode://2351f92b96adcaaa0f648e4646677052ca20943756a7005f378907420aa85ac2671
  18. 721b0048496ec535611624b25442689d1f5f94764276598b8f31949e5a6de@[::]:30303
  19. INFO [02-07|22:25:16] RLPx listener up self=enode://2351f92b96adcaaa0f648e4646677052ca20943756a7005f378907420aa85ac2671
  20. 721b0048496ec535611624b25442689d1f5f94764276598b8f31949e5a6de@[::]:30303
  21. INFO [02-07|22:25:16] IPC endpoint opened: /root/.ethereum/geth.ipc

总结

这样以太坊的开发环境的配置就大功告成了。以太坊是一个分布式的账本数据库,在机器上运行geth后,该机器就成为以太坊的一个P2P节点,会不断更新本机的以太坊分布式账本数据库。



声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/768842
推荐阅读
相关标签
  

闽ICP备14008679号