In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to build a linux ethereum development environment, concise and easy to understand, absolutely can make your eyes shine, through the detailed introduction of this article I hope you can gain something.
I. Preparation before installation 1.1 View the current CPU architecture
Execute the following command in the terminal to determine whether the architecture is 32-bit or 64-bit:
~$ uname -px86_64
If you see output x86_64, then it's a 64-bit system, otherwise it's 32-bit.
1.2 download tool
Make sure you install the download tool wget:
~$ wget -VGNU Wget 1.17.1 built on linux-gnu
If you don't already have wget installed, use apt-get to install it
~$ sudo apt-get install wget II. Install DApp Development Environment 2.1 Install Node.js
First, download different precompiled versions according to whether your linux is 32-bit or 64-bit. We use the official long-term support version 8.10.0 LTS: 64-bit:
~$ wget https://nodejs.org/dist/v8.10.0/node-v8.10.0-linux-x64.tar.gz
32:
~$ wget https://nodejs.org/dist/v8.10.0/node-v8.10.0-linux-x86.tar.gz
Then extract to the current directory, for example 64 bits:
~$ tar zxvf node-v8.10.0-linux-x64.tar.gz
Then modify.bashrc to set the relevant environment variables:
~$ echo "export NODE_HOME=$HOME/node-v8.10.0-linux-x64" >> .bashrc~$ echo "export NODE_PATH=$NODE_HOME/lib/node_modules" >> .bashrc~$ echo "export PATH=$NODE_HOME/bin:$PATH" >> .bashrc
Finally reload.bashrc (or log back in) to make node work:
~$ source .bashrc
Now you can use node:
~$ node -v8.10.02.2 Install Node Emulator
To quickly develop and test Ethereum DApps, we typically use Ethereum node emulators to simulate blockchains, the most popular node emulator being Ganache, formerly known as TeseRPC.
Execute the following command at the terminal:
~$ npm install -g ganache-cli
After installation, execute the command to verify successful installation:
~$ ganache-cliGanache CLI v6.0.3 (ganache-core: 2.0.2)
To learn more about ganache command line usage, you can see Ethereum ganache CLI command line parameters detailed explanation
2.3 Install the solidity compiler
Solidity is the programming language for developing Ethereum smart contracts. If you are not familiar with it, you can check out the introduction of Ethereum Solidity development language.
~$ npm install -g solc
After installation, execute the command to verify successful installation
~$ solcjs -version0.40.2+commit.3155dd80.Emscripten.clang2.4 install web3~$ npm install -g web3@0.20.2
Installation Verification:
~$ node -p 'require("web3")'{[Function: Web3] providers:{…}}2.5 Install truffle framework
Execute the following command to install the truffle development framework:
~$ npm install -g truffle
Verify installation:
~$ truffle versionTruffle v4.1.3 (core 4.1.3)2.6 Install webpack
Run the following command to install webpack:
~$ npm install -g webpack@3.11.0
verify the installation
~$ webpack -v3.11.0 III. Building a sample project 3.1 Creating a new DApp project
Execute the following command to create and enter the project directory:
~$ mkdir demo~$ cd demo
Then initialize the project skeleton structure with the webpack template:
~/demo$ truffle unbox webpackDownloading…Unpacking…Setting up…Unbox successful. Sweet! 3.2 Install NPM packages that your project depends on
Execute the following command to install the nmp package:
~/demo$ npm install3.3 modify truffle configuration
In truffle.js, change port to 8545 because ganache-cli listens on port 8545:
module.exports = { networks:{ development: { … port: 8545 … } }}3.4 Start Node
Execute the following command to launch the Node Emulator to deploy contracts and execute transactions:
~/demo$ ganache-cli 3.5 compile contract
Execute the following command to compile the project contract:
~/demo$ truffle compile3.6 deployment contract:
Execute the following command to deploy the contract:
~/demo$ truffle migrate3.7 Launch DApp
Execute the following command to launch the DApp:
~/demo$ npm run dev
Visit http://localhost:8080 in your browser
If you want your DApp to be accessible from other machines, modify package.json:
{ scripts:{ "dev": "webpack-dev-server --host 0.0.0.0" }} The above is how to build a Linux Ethereum development environment. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.