今年上半年开始接触基于区块链的以太坊智能合约编程。由于网络现有资料大多使用truffle2.0框架,而更新的truffle3.0在使用习惯上有较大改动,很多教程已经不太适合新手使用。这里在吸收了部分网络资源,及多次自我尝试后,较为详细总结了linux系统下利用truffle3.0+testrpc完成以太坊智能合约+DApp开发用到的环境搭建过程,并归纳了开发过程中遇到的一些问题及解决方案,合约编程语言为solidity。
环境搭建
(打开终端:同时按住Ctrl + Alt + T键)
1.安装git
sudo apt-get install git
* 如果在安装git时出现E:Package 'git' has no installation candidate错误提示,即可使用:sudo apt-get install git-core
* git --version 查看是否安装成功
2.安装nodejs
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
* nodejs -v 查看是否安装成功
3.安装solc和solc-cli
sudo npm install -g solc solc-cli --save-dev
* solcjs --help查看是否安装成功
4.安装solc二进制包(使用geth要用到)
sudo add-apt-repository ppa:ethereum/ethereum<