Emerald CLI

Last updated 18 hours ago

Emerald has similar characteristics to Truffle Framework, however, integrates the tools of the Emerald Platform and more.

GitHub https://github.com/ETCDEVTeam/emerald

Dependencies

We recommend installing node.js via a node.js version manager. If you have node.js & npm already installed on your operating system, then remove them completely before reinstalling node with a node.js manager. If you have a node manager installed, such as nodenv or nvm, then you can move onto installing the emerald cli.

MacOS
Linux
Windows

Install nodenv and node-build using homebrew.

$ brew install nodenv
$ brew install node-build

Confirm nodenv and node-build are installed

$ nodenv -v
nodenv 1.1.2
$ node-build --version
node-build 3.0.18

Install stable node version using nodenv install <version> and make global using nodenv global 8.11.1

$ nodenv install 8.11.1
$ nodenv global 8.11.1

Then initialize nodenv.

$ nodenv init

You may be prompted to add or append .bash_profile

$ nodenv init
# Load nodenv automatically by appending
# the follow to ~/.bash_profile:
eval "$(nodenv init -)"

Simply add eval "$(nodenv init -)" to .bash_profile or create a .bash_profile if one does not exist already. Finally, run nodenv init when .bash_profile has been appended.

Confirm node directory. Node and NPM should be ready to use now.

$ which node
/Users/JohnSmith/.nodenv/shims/node

Dependencies Installed

Now that node and npm are installed via a node.js package manager, move onto the Install of the Emerald CLI.

Do not install node.js with apt-geton Ubuntu. If you installed node.js with the built in package manager, then remove it

sudo apt-get purge nodejs && sudo apt-get autoremove && sudo apt-get autoclean

Installing nvm

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Confirm nvm installation

$ nvm --version

Run the following command to increase the amount of inotify watches.

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Install stable node version

$ nvm install 10.11.0

Setup node version as the default

$ nvm use 10.11.0
$ nvm alias default 10.11.0

Confirm node version

$ node -v
v10.11.0

Update npm version

$ npm install -g npm

Confirm node version

$ npm -v
6.4.1

Dependencies Installed

Now that node and npm are installed via a node.js package manager, move onto the Install of the Emerald CLI.

Option 1 - Using a Linux VM

Windows users can install a Virtual Machine running Linux. Generally users need a Linux image (.iso) to install the operating system to their VM software.

  1. Download and install a Linux image from Ubuntu or any other Linux distribution supported by your desired VM software.

  2. Download and install VirtualBox or your desired VM software.

  3. Launch the VM and start your Virtual Machine. You may be prompted to use the Linux image (.iso) to complete the installation.

Option 2 - Enabling Windows Subsystem for Linux

Install the Windows Subsystem for Linux (WSL)

Windows Features > (switch on) Windows Subsystem for Linux,

or

Open PowerShell as Administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install Linux Distribution of Choice

Download and install from the Windows Store

From Distro page select Get

Complete Initialization of Your Distro

First initializing bash would prompt to create user and password which doesn't effect native Windows user.

Default distro data location: C:\Users\$HOME\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs

If Linux VM or Linux distro is successfully setup, then follow Linux instructions to complete installing dependencies.

Install

MacOS
Linux

Install Emerald CLI

$ brew install libgcrypt
$ npm install -g https://github.com/ETCDEVTeam/emerald.git

This process may take a few minutes. When it's done, Emerald will be installed globally. Open a new terminal window and run emerald -h to view commands and options.

$ emerald -h
emerald 0.0.2
USAGE
emerald <command> [options]
COMMANDS
new Create a new project
testrpc Run testnet for ethereum classic
wallet Boot Emerald Wallet
explorer Boot Explorer
deploy Deploy solidity to network
help <command> Display help for a specific command
GLOBAL OPTIONS
-h, --help Display help
-V, --version Display version
--no-color Disable colors
--quiet Quiet mode - only displays warn and error messages
-v, --verbose Verbose mode - will also output debug messages

If emerald commands return nothing, then nodenv may simply need to rehash.

$ nodenv rehash

Updating Emerald CLI

$ brew upgrade libgcrypt
$ npm install -g https://github.com/ETCDEVTeam/emerald.git

Install Emerald CLI

$ npm install -g https://github.com/ETCDEVTeam/emerald.git

This process may take a few minutes. When it's done, Emerald will be installed globally. Open a new terminal window and run emerald -h to view commands and options.

Usage

emerald new

To create a new emerald project, run emerald new in terminal.

$ mkdir my-dapp
$ cd my-dapp
$ emerald new
New Emerald project created

By creating a new emerald project with the command emerald new, emerald will populate the working directory, my-dapp with an Emerald DApp environment.

.
├── config
│   └── jest
│   ├── file-transform.ts
│   └── polyfills.ts
├── contracts
│   ├── Migrations.sol
│   └── Todos.sol
├── migrations
│   ├── 1_initial_migration.js
│   └── 2_deploy_contracts.js
├── package-lock.json
├── package.json
├── public
│   ├── favicon.ico
│   └── index.html
├── src
│   ├── App.test.tsx
│   ├── App.tsx
│   ├── contract-interfaces
│   │   └── ITodos.tsx
│   └── index.tsx
├── test
│   └── Todos.js
├── truffle-config.js
├── truffle.js
├── tsconfig.json
├── tslint.json
└── webpack.config.ts

emerald testrpc

To run an Ethereum Classic testNet (Sputnik VM Dev), run emerald testrpc

$ emerald testrpc
address: 74cbe1c04a9221f2a25050ba2fc6ef5cef77fee4
private key: 0x130bc24e27cd27f6bfaa3478db269f3fa703965e6c7a24d8ab3fc3b572ef2b18

Emerald testRPC will return 10 testNet addresses with their associated private keys.

Terminating the terminal running the testRPC will terminate the local testNet. Simply leave it to run in the background until you no longer need it running.

emerald explorer

To view a blockchain explorer, run emerald explorer

$ emerald explorer

The local block explorer will publish to http://localhost:3000/blocks. If a emerald testrpc is running, the explorer can toggle between the local testnet or mainnet in the app bar.

Emerald Explorer

emerald wallet

To open the Emerald Wallet, run emerald wallet

$ emerald wallet

This will open the Emerald Wallet. If emerald testRPC is running, Emerald will will display the block height of the local testNet in the app bar.

Emerald Wallet

emerald deploy

To deploy an Emerald DApp to an Ethereum Classic network, run emerald deploy in the working directory of an Emerald DApp. The network specifications can be customized in truffle.js if needed. By default Emerald Wallet will connect with the emerald testRPC.

$ emerald compile
$ emerald deploy
migrated

Deployment will fail if no network is running or configured properly in truffle.js

emerald help

To view commands and options, run emerald -h

License

License Apache 2.0