Geth (Go Ethereum) is Ethereum client. It is Ethereal node to access to blockchain, run the Ethereal Virtual Machine (EVM) and mine. Geth is command line application. Truffle is a develop framework to smart contracts. I tried to install both on Ubuntu 22 using CLI only and what happened. With geth was simple, I downloaded tar.gz file, unpacked and it worked, but with truffle it was painful.
OK geth first. Download:
curl -O https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.12.2-bed84606.tar.gz |
Unpack:
tar -zxvf geth-linux-amd64-1.12.2-bed84606.tar.gz |
Check if it works:
cd geth-linux-amd64-1.12.2-bed84606/ ./geth -v geth version 1.12.2-stable-bed84606 |
Now truffle. The first step is npm installation, npm is the package manager for the Node JavaScript platform.
apt-get install npm |
I need npm for truffle add-on installation.
npm install -g truffle |
Check truffle version:
truffle version /usr/local/lib/node_modules/truffle/build/3618.bundled.js:24586 nbsp; nbsp; return _this.outputFormatter && res ? _this.outputFormatter(res, this?.hexFormat) : res; ^ SyntaxError: Unexpected token ‘.’ |
Ops! truffle does not work. To make it working we need to change npm version using nvm (Node Version Manager).
Current npm and node versions are:
npm -v 8.5.1 node -v v12.22.9 |
We need higher.
Installing nvm by running the nvm install.sh script:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash |
Add nvm to .bashrc script:
source ~/.bashrc |
List of availed node versions:
nvm list -> v16.20.2 system default -> 16.20.2 (-> v16.20.2) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v16.20.2) (default) stable -> 16.20 (-> v16.20.2) (default) lts/* -> lts/hydrogen (-> N/A) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.12 (-> N/A) lts/fermium -> v14.21.3 (-> N/A) lts/gallium -> v16.20.2 lts/hydrogen -> v18.17.1 (-> N/A) |
6.20.2
Let us select version v16.20.2, install it and use:
nvm install 16.20.2 nvm use 16.20.2 |
New npm and node versions are:
npm -v 8.19.4 node -v v16.20.2 |
truffle version Truffle v5.11.3 (core: 5.11.3) Ganache v7.9.1 Solidity v0.5.16 (solc-js) Node v16.20.2 Web3.js v1.10.0 |
The truffle suit shows also Ganache and Solidity versions.
Solidity is compiler for solidity language, its location is:
/usr/local/lib/node_modules/truffle/node_modules/solc/solcjs Must provide a file |
Ganache is personal Ethereum Blockchain which may be used for testing Ethereum blockchain development tasks.
Starting ganache server by CLI command:
/usr/local/lib/node_modules/truffle/node_modules/.bin/ganache-cli ganache v7.9.1 (@ganache/cli: 0.10.1, @ganache/core: 0.10.1) Starting RPC server Available Accounts Private Keys HD Wallet Default Gas Price BlockGas Limit Call Gas Limit Chain RPC Listening on 127.0.0.1:8545 |