/mana

Ethereum full node implementation written in Elixir.

Primary LanguageElixirOtherNOASSERTION

Mana-Ethereum

CircleCI Waffle.io - Columns and their card countGitter chat

Mana-Ethereum is an open-source Ethereum blockchain client built using Elixir. Elixir runs on the Erlang Virtual Machine, which is used for distributed systems and offers massive scalability and high visibility. These properties make Elixir a perfect candidate for blockchain network development.

In the current Ethereum ecosystem, a majority of active nodes on the network are Geth or Parity nodes. Mana-Ethereum provides an additional open-source alternative. Our aim is to create an open, well-documented implementation that closely matches the protocols described in the Ethereum yellow paper.

Mana-Ethereum is currently in development. See the Project Status and Project FAQs for more information.

Dependencies

  • Elixir ~> 1.8.0

Installation

  • Clone repo with submodules (to access the Ethereum common tests)

    git clone --recurse-submodules https://github.com/mana-ethereum/mana.git
    
  • Go to the mana subdirectory cd mana

  • Run bin/setup

Running a node

Peer-to-peer communication is currently in development. A command-line interface is available for chain syncing.

Sync From RPC Client

To sync a chain from an RPC Client (e.g. Infura) or a local client, run the following command:

mix sync --chain ropsten

You can sign up for an Infura API key here. This will ensure your requests are not throttled.

mix sync --chain ropsten --provider-url https://ropsten.infura.io/v3/<api_key>

Alternatively, you can sync via IPC to a local node (like Parity or Geth running locally):

mix sync --chain ropsten --provider-url ipc://~/Library/Application\ Support/io.parity.ethereum/jsonrpc.ipc

Once syncing begins you will see a timestamp and a running list of verified blocks.

Releases

To build a release, run: mix release, which will build a release in _build/dev/rel/mana/bin/mana.

Then you can run:

_build/dev/rel/mana/bin/mana run --no-discovery --bootnodes enode://...

which will start a DevP2P sync with a local peer.

Known Sync Issues

Updated Dec-5-2018

  • We've restarted mainnet syncing and are at block ~ 2,470,630. We are currently investigating performance and storage issues #622, #623, and #624.
  • Ropsten sync is in progress as we've reached the Constantinople fork. Current block is ~ 4,253,000 - Oct-18-2018

Helpful debugging tools

When debugging block verification failures, we have found etherscan tools extrememly helpful. Take block 177610 for example:

We can look at the block information, and dive into the transaction information. From that page, the "Tools & Utilities" dropdown provides useful debugging tools. Two of the most valuable are Geth DebugTrace and Remix Debugger.

  • Geth DebugTrace allows us to compare each operation and its gas consumption against our implementation.

  • Remix Debugger allows us to compare the stack against our implementation's stack for each cycle of the virtual machine.

NOTE: for the Remix Debugger, you may want to add the block number at the top before pressing the play button.

To log the operation, gas consumption, and stack in our application, please see the EVM README example setup.

Testing

Run:

mix test --exclude network

Tests tagged with network integrate with other nodes and cannot run unless another node is running in parallel. Use the --exclude network flag to exclude these tests.

If you want to only run Ethereum common tests, we currently have:

# Ethereum Virtual Machine tests
cd apps/evm && mix test test/evm_test.exs

# Ethereum Blockchain tests
cd apps/blockchain && mix test test/blockchain_test.exs

# Ethereum General State tests
cd apps/blockchain && mix test test/blockchain/state_test.exs

# Ethereum Transaction tests
cd apps/blockchain && mix test test/blockchain/transaction_test.exs

Test Status

Ethereum common tests are created for all clients to test against. See the common test documentation for more information.

VMTests = 100% passing

Hardfork BlockchainTests passing GeneralStateTests passing Complete?
Frontier 100% (1328/1328) 100% (1041/1041)
Homestead 100% (2211/2211) 100% (2069/2069)
HomesteadToDaoAt5 100% (4/4) N/A
TangerineWhistle 100% (1270/1270) 100% (1120/1120)
SpuriousDragon 100% (1201/1201) 100% (1193/1193)
Byzantium 100% (4954/4954) 100% (4813/4813)
Constantinople 100% (10627/10627) 100% (10588/10588)

View the community Constantinople Project Tracker.

Updating Common Tests

The Ethereum common tests are in a submodule. To update:

% cd ethereum_common_tests
% git checkout develop
% git pull

Project Status

Functionality Status
Encoding and Hashing The RLP encoding protocol and the Merkle Patricia Tree data structure are fully implemented.
Ethereum Virtual Machine Our EVM currently passes 100% of the common VM tests. We are refining our implementation to address subtle differences between our EVM and other implementations.
Peer to Peer Networking Currently we can connect to one of the Ethereum bootnodes, get a list of peers, and add them to a list of known peers. We have fully implemented the modified kademlia DHT.

We can also successfully perform the encrypted handshake with peer nodes and derive secrets to frame the rest of the messages. We are currently configuring ExWire to work against a local Geth/Parity node.
DEVp2p Protocol and Ethereum Wire Protocol We are in the process of addressing networking layer issues. Progress is being tracked in Issue #407.

Documentation

To view module and reference documentation:

  1. Generate documentation. mix docs

  2. View the generated docs. open doc/index.html

License

Licensed under either of:

at your option.

Contributing

See the CONTRIBUTING document for contribution, testing and pull request protocol.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

References