[Beginner Series] Ethereum Smart Contract Development Environment Setup (Ubuntu 14.04)
Development Environment Overview
The Ethereum development environment mainly uses the following components:
- Node.js
- geth (go-ethereum, an Ethereum node implemented in Go language)
- solc (Solidity language compiler)
- testrpc (Local test environment)
- truffle (Contract development framework)
For editors, there are browser-based online editors like Remix, IDE plugins (IntelliJ IDEA/Visual Studio), and text editor plugins (Vim/Atom/SublimeText). You can choose according to personal preference and needs.
Let's look at the software installation process in the Ubuntu 14.04 environment.
Install Node.js
First install git
sudo apt-get install gitInstall NodeJs
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejsAfter installing Node, given the network environment in China, please use the following command to modify the npm repository to a domestic address (such as Alibaba)
npm config set registry https://registry.npm.taobao.orgInstall geth
There are currently four runnable Ethereum clients, implemented in C++, Go, Python, and Java, all almost fully compatible with the Ethereum protocol. Clients implemented in C++ and Go are currently fully compatible.
The most popular client now is geth.
You can get the latest geth version via https://geth.ethereum.org/downloads/.
You can also download the official graphical wallet software via https://ethereum.org/, which comes with geth.
mkdir wallet
wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.7.2-1db4ecdc.tar.gz
gzip -unzip geth-linux-amd64-1.7.2-1db4ecdc.tar.gz
tar xvf geth-linux-amd64-1.7.2-1db4ecdc.tarInstall solc
sudo npm install -g solc solc-cli --save-devUse the following command to test if the installation is correct:
solcjs --helpInstall testrpc
testrpc is an Ethereum environment simulated in memory locally. It is more convenient and faster for development and debugging. After your contract passes the test in testrpc, it can be deployed to geth.
testrpc also includes a Javascript version of the Ethereum Virtual Machine (EVM).
sudo npm install -g ethereumjs-testrpcInstall truffle
truffle is one of the most popular development frameworks for Ethereum. You can use truffle and testrpc to quickly develop and debug smart contracts.
sudo npm install -g truffleYou can view the version of truffle with the following command:
truffle version