This project contains the evaluation setup for ETH Relay. The evaluation is performed using block headers of the main Ethereum network which have been collected between December 2019 - January 2020.
- Node.js
- Truffle
- Docker
- Ethereum node (e.g., Ganache or Parity Dev Chain)
Clone the repository and then run the following commands in the project root:
$ npm install
$ npm link
The block headers used for the evaluation need to be stored in a PostgreSQL database (an SQL dump can be found here). Before running the experiments, set the correct ENV variables required for connecting to the database, e.g.,
$ export PGUSER=postgres \
PGHOST=localhost \
PGPASSWORD=postgres \
PGDATABASE=blockheader \
PGPORT=5432 \
INFURA_ENDPOINT=https://mainnet.infura.io/ \
GENESIS_BLOCK=9121452 \
START_BLOCK=9121453 \
NO_OF_BLOCKS=100
Make sure Ganache is running and configured to use port 8545.
TO deploy the smart contracts necessary for the evaluation, run:
$ ethrelay-evaluation deploy
To setup the smart contracts for the evaluation, simply run:
$ ethrelay-evaluation setup
To start the evaluation, run:
$ ethrelay-evaluation submission
$ ethrelay-evaluation dispute
You might run into the issue that your account does not have enough funds for the evaluation. In that case, create a new Ganache workspace pre-funding each account with enough funds (e.g., 100 000 000 ETH).
Make sure you have Docker installed, then run:
./start-parity.sh
This will start a Parity Dev Chain in Docker with a default account already pre-funded with lots of Ether.
Then you can setup and run the evaluation by running the following commands, respectively.
$ ethrelay-evaluation deploy parity
$ ethrelay-evaluation setup parity
$ ethrelay-evaluation submission parity
$ ethrelay-evaluation dispute parity
Setup the Ethereum node and add another configuration with a new network name (e.g., mynetwork) in the truffle-config.js
file.
Then setup and start the evaluation with the following commands.
$ ethrelay-evaluation deploy mynetwork
$ ethrelay-evaluation setup mynetwork
$ ethrelay-evaluation submission mynetwork
$ ethrelay-evaluation dispute mynetwork
The directory ./results
contains the output of both evaluation scripts (submission and dispute) and a comparison
of the branch junctions logged during submission and the branch junctions of the used dataset.
Run npm unlink
to remove the created symlink.
The Ethash smart contract needs to be set up with the epoch data required for performing full block validations.
By default the project contains data for epochs 304-308.
The data is stored in corresponding JSON files like ./epochs/<epoch>.json
To generate new epoch JSON files, install the ETH Relay Go Client
and run the command $ go-ethrelay submit epoch <epoch> --json
.
The gas costs of verifying a transaction are evaluated by verifying the same transaction (0xf04ea290db7113d1cb6d5bd6519140ac9d2c70ec6c13a76b750db749197225af) over and over again with an ever growing number of succeeding blocks.
The Merkle proof used for the verification has been pre-generated and can be found in ./merkleproofs/
.
If you want to tweak the evaluation to evaluate another transaction instead, you need to generate the correct Merkle proof of the transaction.
You can do so using the ETH Relay Go Client
by running the command $ go-ethrelay verify transaction <txHash> --json
.