Warning
This is an Early Prototype. It works, but not (yet) intended for production use!!
This project is an experimental add-on to Polkadot SDK's pallet-contracts to make it Ethereum RPC -compatible.
Install customized cargo-contract
tool:
Why?
Our 🦆-chain has pallet-contracts on board and at the same time works with Ethereum 20-bytes Account format. The latter fact is required so that our node can understand MetaMask-signed transactions. But for the existing ink! contracts tooling this is an unusual setting, as they're expected to work with 32-bytes long Accounts.
For this reason, to work with our ink! contracts on this chain, we use a fork of cargo-contract tool which speaks with our node the same language! Run this command to install it:
cargo install --git https://github.com/agryaznov/cargo-contract --branch v4-ethink --force
Run tests:
cargo test
Inject a well-known keypair of Baltathar into ethink! node's keystore:
(This step is needed only of you want to sign transactions on the node side)
cargo run -- key insert --dev --key-type "ethi" -d tmp --scheme ecdsa
Start the ethink! development node:
cargo run -- --dev
Open your MetaMask and add a new network:
- Network name: Duck 🦆
- New RPC URL: http://localhost:9944
- Chain ID: 42
- Currency symbol: 🥚
Import a couple of pre-funded well-known development accounts into your MetaMask in order to be able to sign and send transactions.
Caution
It is highly recommended to use a separate MetaMask instance for this (e.g. in a dedicated browser profile), not to mix the development accounts (whose private keys are compromised by design) with your real money-holding accounts.
That's it! You should right away be able to communicate with the Duck 🦆 chain using your MetaMask. Let's see it in action, as described in the Demo section below.
ethink! comes with e2e integration tests, grouped into test suites:
Use this command to run the integration tests (at the project root):
cargo test --test "*"
Build documentation for the project crates:
cargo doc --document-private-items --open
The book is written with mdBook tool.
To install it, run:
cargo install mdbook
Then build and open the book:
cd docs/ethink-book
mdbook serve --open
Happy reading!
A comprehensive step-by-step Demo is described in the book chapter. You will be able to deploy an ink! contract to ethink-node and use the demo dApp via MetaMask. Go ahead and give it a try!
- The table with all Ethereum RPC methods needed along with their description and implementation status.
- Collection of curl composed request templates to Ethereum RPC exposed by ethink! node.