Laconic state machine
Go to file
Federico Kunze c30205cae9
error migration (#254)
* migrate errors

* ante handler errors

* return err instead of panic
2020-04-16 11:47:39 -04:00
.circleci Tools configuration and linters (#215) 2020-03-16 19:53:24 -03:00
.github add CHANGELOG.md (#184) 2020-03-06 20:00:03 -03:00
app error migration (#254) 2020-04-16 11:47:39 -04:00
cmd upgrade changes cleanup (#236) 2020-04-01 15:49:21 -03:00
core Updating ethereum version from fork (#68) 2019-07-11 14:05:34 -04:00
crypto Remove unused encoding package (#214) 2020-03-13 13:14:59 -03:00
docs TX Routing Refactor (#496) 2018-11-28 14:19:22 -08:00
importer upgrade changes cleanup (#236) 2020-04-01 15:49:21 -03:00
rpc Implement eth_newPendingTransactionFilter #51 (#251) 2020-04-16 16:53:14 +02:00
types error migration (#254) 2020-04-16 11:47:39 -04:00
utils Implements eth_getProof (#122) 2019-10-16 09:46:50 +09:00
version Query and bug fixes (#110) 2019-09-26 11:36:23 -04:00
x/evm error migration (#254) 2020-04-16 11:47:39 -04:00
.codecov.yml Tools configuration and linters (#215) 2020-03-16 19:53:24 -03:00
.gitignore eth_estimateGas (#128) 2019-10-30 13:30:24 -05:00
.golangci.yml Tools configuration and linters (#215) 2020-03-16 19:53:24 -03:00
CHANGELOG.md update web3 transaction hash from RLP (#250) 2020-04-13 19:08:43 -04:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2018-07-17 11:52:20 -04:00
CONTRIBUTING.md Implement eth_pendingTransactions, bump sdk version (#124) 2019-10-19 08:23:09 +09:00
Dockerfile updated Dockerfile (#175) 2020-03-18 08:43:02 -04:00
go.mod Bump github.com/spf13/viper from 1.6.2 to 1.6.3 (#244) 2020-04-10 12:19:34 -04:00
go.sum Bump github.com/spf13/viper from 1.6.2 to 1.6.3 (#244) 2020-04-10 12:19:34 -04:00
gometalinter.json Upgrade geth and cleanup 2018-09-28 17:40:58 -04:00
init.sh update key name in init.sh (#243) 2020-04-08 15:00:30 -04:00
LICENSE Initial commit 2018-06-10 14:25:18 +01:00
Makefile Linted Repo (#136) 2019-11-01 10:26:53 -05:00
README.md added init script with test password (#228) 2020-03-18 08:42:46 -04:00

CircleCI Go Report Card

Ethermint

WARNING: Ethermint is under VERY ACTIVE DEVELOPMENT and should be treated as pre-alpha software. This means it is not meant to be run in production, its APIs are subject to change without warning and should not be relied upon, and it should not be used to hold any value. We will remove this warning when we have a release that is stable, secure, and properly tested.

What is it?

ethermint will be an implementation of the EVM that runs on top of tendermint consensus, a Proof of Stake system. This project has as its primary goals:

  • Hard Spoon enablement: This is the ability to take a token from the Ethereum mainnet and "spoon" (shift) the balances over to another network. This feature is intended to make it easy for applications that require more transactions than the Ethereum main chain can provide to move their code over to a compatible chain with much more capacity.
  • Web3 Compatibility: In order enable applications to be moved over to an ethermint chain existing tooling (i.e. web3 compatible clients) need to be able to interact with ethermint.

Implementation

Completed

  • Have a working implementation that can parse and validate the existing ETH Chain and persist it in a Tendermint store
  • Implement Ethereum transactions in the CosmosSDK
  • Implement web3 compatible API layer
  • Implement the EVM as a CosmosSDK module
  • Allow the Ethermint EVM to interact with other Cosmos SDK modules

Current Work

  • Ethermint is a functioning Cosmos SDK application and can be deployed as its own zone
  • Full web3 compatibility to enable existing Ethereum applications to use Ethermint

Next Steps

  • Hard spoon enablement: The ability to export state from geth and import token balances into Ethermint

Building Ethermint

To build, execute the following commands:

# To build the project and install it in $GOBIN
$ make install

# To build the binary and put the resulting binary in ./build
$ make build

Starting a Ethermint daemon (node)

The following config steps can be performed all at once by executing the init.sh file located in the root directory like this:

./init.sh

This bash file removes previous blockchain data from ~/.emintd and ~/.emintcli. It uses the keyring-backend called test that should prevent you from needing to enter a passkey. The keyring-backend test is unsecured and should not be used in production.

To initalize your chain manually, first create a key to use in signing the genesis transaction:

emintcli keys add mykey --keyring-backend test

replace mykey with whatever you want to name the key

Then, run these commands to start up a node

# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
emintd init mymoniker --chain-id 8

# Set up config for CLI
emintcli config keyring-backend test
emintcli config chain-id 8
emintcli config output json
emintcli config indent true
emintcli config trust-node true

# Allocate genesis accounts (cosmos formatted addresses)
emintd add-genesis-account $(emintcli keys show mykey -a) 1000000000000000000photon,1000000000000000000stake

# Sign genesis transaction
emintd gentx --name mykey --keyring-backend test

# Collect genesis tx
emintd collect-gentxs

# Run this to ensure everything worked and that the genesis file is setup correctly
emintd validate-genesis

# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
emintd start --pruning=nothing

Note: If you used make build instead of make install, and replace all emintcli and emintd references to ./build/emintcli and ./build/emintd respectively

Starting Ethermint Web3 RPC API

After the daemon is started, run (in another process):

emintcli rest-server --laddr "tcp://localhost:8545" --unlock-key mykey

and to make sure the server has started correctly, try querying the current block number:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545

or point any dev tooling at http://localhost:8545 or whatever port is chosen just as you would with an Ethereum node

Clearing data from chain

Data for the CLI and Daemon should be stored at ~/.emintd and ~/.emintcli by default, to start the node with a fresh state, run:

rm -rf ~/.emint*

To clear all data except key storage (if keyring backend chosen) and then you can rerun the commands to start the node again.

Keyring backend options

The instructions above include commands to use test as the keyring-backend. This is an unsecured keyring that doesn't require entering a password and should not be used in production. Otherwise, Ethermint supports using a file or OS keyring backend for key storage. To create and use a file stored key instead of defaulting to the OS keyring, add the flag --keyring-backend file to any relevant command and the password prompt will occur through the command line. This can also be saved as a CLI config option with:

emintcli config keyring-backend file

Exporting Ethereum private key from Ethermint

To export the private key from Ethermint to something like Metamask, run:

emintcli keys export-eth-key mykey

Import account through private key, and to verify that the Ethereum address is correct with:

emintcli keys parse $(emintcli keys show mykey -a)

Tests

Integration tests are invoked via:

$ make test

To run CLI tests, execute:

$ make test-cli

Ethereum Mainnet Import

There is an included Ethereum mainnet exported blockchain file in importer/blockchain that includes blocks up to height 97638. To execute and test a full import of these blocks using the EVM module, execute:

$ make test-import

You may also provide a custom blockchain export file to test importing more blocks via the --blockchain flag. See TestImportBlocks for further documentation.

Community

The following chat channels and forums are a great spot to ask questions about Ethermint: