Welcome to the Ewasm public testnet! This repository is the primary point of coordination for the testnet. Read on for more information about how to:
- Write smart contracts in supported languages and compile them to Wasm bytecode
- Transact on the testnet, such as by deploying smart contracts compiled to Ewasm bytecode
- Run a testnet node locally
- Add a node to the testnet
- Participate in mining
- Participate in network upgrades
- Contribute to development and devops
Ewasm, which stands for Ethereum-flavored WebAssembly, is the primary candidate to replace EVM (the Ethereum virtual machine) as part of the Ethereum 2.0 "Serenity" roadmap. It is also proposed for adoption on the Ethereum mainnet. Ewasm is a deterministic smart contract execution engine built on the modern, standard WebAssembly virtual machine.
For more information on Ewasm, please refer to the following resources:
- Ewasm background, motivation, goals, and design
- The current Ewasm design spec
- CoinFund Live: Crypto Talks with Ewasm's Lane Rettig and Alex Beregszaszi (this is a high-level overview of the project's goals and current status as of 10/2018, including some helpful background on the broader Wasm ecosystem)
- WebAssembly for Web 3.0 with Alex Beregszaszi, Peter Czaban, Sergei Shulepov & Lane Rettig from the Web3 Summit, October 2018
- Latest Ewasm community call including live demo of the testnet
- Why eWASM? by Alex Beregszaszi (@axic)
- Panel: entire eWASM team discussion and Q&A
- Ewasm community meetup at ETHBuenosAires
The primary communication channels for the Ewasm project are GitHub and Gitter.
- You may log issues in this repository with questions about the testnet
- You may make contributions to this repository as pull requests
- Join the public Ewasm chatroom on Gitter
The team also hosts a (roughly) fortnightly public "Ewasm community hangout" call. Look for the the next scheduled call in ewasm/pm issues. Calls are announced, including dial-in information, in ewasm/Lobby. Calls are also livestreamed and recorded.
The Ewasm testnet supports executing EVM 1.0 (Byzantium) bytecode and Ewasm bytecode. The chain id is set to 0x42 (decimal 66).
There are two further technical differences:
- the code size limit introduced by Spurious Dragon has been lifted and there is no upper limit (as Wasm bytecode is more verbose than the EVM equivalent)
- zero bytes in contract bytecode are not subsidised during deployment (they cost the same as non-zero bytes)
You don't need any special infrastructure to transact on the Ewasm testnet. You may run your own node (see below), or you may use the public node. You may view the list of testnet tools here: http://ewasm.ethereum.org/. Start by requesting test ether from the faucet:
- Configure Metamask to use the public node. Open Metamask, tap the network selector at the top, and click Custom RPC. Enter the following URL and click Save: http://ewasm.ethereum.org:8545.
- Browse to the faucet, make sure it read your public key correctly from Metamask in the "user" section, then tap "request 1 ether from faucet" in the "faucet" section.
- Click the txid that appears in the "transactions" section and watch your faucet transaction get mined.
Voila! You're now ready to transact on the testnet.
Solidity is not currently capable of outputting Ewasm bytecode. However, Ewasm support is on the Solidity roadmap. Given that the Ewasm testnet is capable of running EVM bytecode it is possible to use Solidity as a contract language.
You can deploy smart contracts written in Solidity and targeting EVM to the Ewasm testnet by using Truffle, just as you do with the Ethereum mainnet, testnets, and testrpc (Ganache). First, install truffle-hdwallet-provider
as follows (note the specific release, @web3-one
):
> npm install --save truffle-hdwallet-provider@web3-one
You'll want to use a truffle.js
such as the following:
var HDWalletProvider = require("truffle-hdwallet-provider");
module.exports = {
networks: {
ewasm: {
network_id: "*",
provider: () => new HDWalletProvider("PRIVATE_KEY", "http://ewasm.ethereum.org:8545"),
},
}
};
Replace PRIVATE_KEY
with the appropriate private key for the account you used to tap the faucet, above. After doing this, the usual truffle commands (such as truffle migrate --network ewasm
) should work.
One of the design goals of the Ewasm project is to support smart contract development in a wide range of languages, using a range of tooling, including existing, mature toolchains such as LLVM (C/C++, Kotlin, Rust, and many others) and JavaScript/TypeScript. In theory, any language that can be compiled to Wasm can be used to write a smart contract (as long as it implements the contract interface and Ethereum interface). See awesome-wasm-langs for a list of such languages.
At present, we've developed support for the following languages and toolchains:
- C/C++ (LLVM) WebAssembly tutorial
- Rust: documentation pending
- AssemblyScript, a subset of TypeScript, which uses the JavaScript toolchain: see the etherts org for more information on writing contracts in AssemblyScript.
If you're interested in adding support for another language, framework, or toolset, see the Contributing section above and reach out.
The testnet currently only supports the go-ethereum (geth) client. Support for aleth (formerly, cpp-ethereum) is a work in progress and more information may be found here.
You may install and configure geth in the following ways:
- manually, from source
- using this preconfigured Docker image
Manually configuring geth requires installing prerequisites, downloading and compiling geth from source with EVMC support, downloading and building Hera (the Ewasm virtual machine connector), then launching geth with Hera set as its EVMC engine.
-
Make sure the prerequisites are installed (Go version 1.7 or later,
cmake
3.5 or later, and a C/C++ compiler).On CentOS-flavored Linux (e.g., Amazon Linux) you can use the following commands:
> sudo yum groupinstall "Development Tools" > wget https://cmake.org/files/v3.12/cmake-3.12.2-Linux-x86_64.sh > sudo bash cmake-3.12.2-Linux-x86_64.sh --prefix=/usr/local > sudo yum install go
On Ubuntu/Debian-flavored system the following commands should work:
> sudo apt-get install build-essential make cmake golang
The genesis is in ewasm-testnet-geth-config.json
This section describes how to run geth node with the Hera backend.
The key component to add Ewasm to geth is EVMC. Aleth supports EVMC out of the box, but geth not yet.
-
Build geth with EVMC
Clone the the ewasm geth fork:
Geth for Ewasm testnet is released regularly by tagging the above fork with
ewasm-testnet-milestoneX
, whereX
stands for a milestone number.(Latest:
ewasm-testnet-milestone1
)> git clone https://github.com/ewasm/go-ethereum -b ewasm-testnet-milestone1 > cd go-ethereum
Build geth following the official build instructions:
> make geth
-
Build Hera as a shared library (full build instructions here):
> git clone https://github.com/ewasm/hera --recursive -b ewasm-testnet-milestone1 > cd hera > mkdir build && cd build > cmake .. -DBUILD_SHARED_LIBS=ON > cmake --build .
-
Download the genesis file and use it to initialize geth:
> wget https://raw.githubusercontent.com/ewasm/testnet/ewasm-testnet-milestone1/ewasm-testnet-geth-config.json > ./build/bin/geth --datadir /tmp/ewasm-node/4201/ init ewasm-testnet-geth-config.json
Note that the
/tmp/ewasm-node/4201
directory name above is arbitrary. It just needs to be unique. -
Run geth with Hera and connect to the testnet:
Use
--vm.ewasm
flag ingeth
to plug in an EVMC VM shared library. Point it to the Hera shared library that you built a moment ago. Additional EVMC options can be provided after a comma. Hera options are documented here.Note also the
--etherbase
,--networkid
, and--bootnodes
commands, below, and copy them verbatim as these are required to connect to and sync with the Ewasm testnet.The
--vmodule
argument sets the verbosity for theeth
andp2p
modules, which will provide lots of juicy debugging information on your node's connection to the other testnet peers, and on its mining, accepting, and propagating blocks. Feel free to reduce verbosity or turn this off.Finally, if you want your node to participate in mining, add the arguments
--mine --miner.threads 1
.Check out the geth CLI wiki page for more information on these commands, or just run
geth --help
.Here's the recommended configuration for connecting your node to the Ewasm testnet:
> ./build/bin/geth \ --vm.ewasm="/path/to/libhera.so,metering=true,fallback=true" \ --datadir /tmp/ewasm-node/4201/ \ --etherbase 031159dF845ADe415202e6DA299223cb640B9DB0 \ --rpc --rpcapi "web3,net,eth,debug" \ --rpcvhosts="*" --rpcaddr "0.0.0.0" \ --rpccorsdomain "*" \ --vmodule "miner=12,rpc=12" \ --mine --miner.threads 1 \ --nodiscover \ --networkid 66 \ --bootnodes "enode://53458e6bf0353f3378e115034cf6c6039b9faed52548da9030b37b4672de4a8fd09f869c48d16f9f10937e7398ae0dbe8b9d271408da7a0cf47f42a09e662827@23.101.78.254:30303"
NOTE: don't forget to specify
networkId
with the same value as the value ofchainID
in the genesis configuration, this is to avoid Metamask errorInvalid Sender
.Note that if you want your node to be automatically restarted if it dies, and to survive system reboots, you'll want to use a tool such as pm2:
> npm install -g pm2
NOTE: this client currently is not supported fully and the instructions here may be wrong.
This section describes how to run geth node with the Wagon VM.
-
Get the code from the PR
> go get github.com/ethereum/go-ethereum > cd $GOROOT/src/github.com/ethereum/go-ethereum > git remote add gballet git@github.com:gballet/go-ethereum.git > git fetch gballet add-ewasm > git checkout add-ewasm
-
Build geth
> go build ./cmd/geth/...
-
Run geth
The Ewasm interpreter will be activated by default as long as you do not specify a
--vm.ewasm=...
on the command line option.> ./geth \ --datadir /tmp/ewasm-node/4201/ \ --etherbase 031159dF845ADe415202e6DA299223cb640B9DB0 \ --rpc --rpcapi "web3,net,eth,debug" \ --rpcvhosts="*" --rpcaddr "0.0.0.0" \ --rpccorsdomain "*" \ --mine --miner.threads 1 \ --nodiscover \ --networkid 66 \ --bootnodes "enode://53458e6bf0353f3378e115034cf6c6039b9faed52548da9030b37b4672de4a8fd09f869c48d16f9f10937e7398ae0dbe8b9d271408da7a0cf47f42a09e662827@23.101.78.254:30303"
NOTE: this client currently is not supported fully and the instructions here may be wrong.
Support for aleth (formerly, cpp-ethereum) is a work in progress and more information may be found here.
Ethstats is a pretty UI for monitoring network state, which allows individual nodes to communicate their state to a centralized server via WebSockets. (See for instance the page for the Ethereum mainnet.) Nodes must be added manually. The Ewasm team maintains an ethstats page for the testnet. If you'd like your node to be added, follow these steps:
-
Make sure that you have a recent version of nodejs installed.
-
Download and configure the eth-net-intelligence-api package:
> git clone https://github.com/cubedro/eth-net-intelligence-api && cd eth-net-intelligence-api > npm install > NODE_ENV=production INSTANCE_NAME="Your instance name" CONTACT_DETAILS="Your contact info (optional)" WS_SERVER=wss://ewasm.ethereum.org WS_SECRET=97255273942224 VERBOSITY=2 node www/app.js
You'll want to run this using pm2
as well if you intend to keep it running long term. See the instructions for eth-net-intelligence-api, especially the build.sh script.
Learn how to create and run Ewasm tests here.
The faucet is a fork of the MetaMask faucet. The fork is maintained here.