DVM(Darwinia Virtual Machine) is fully compatible with EVM (Ethereum Virtual Machine) in Darwinia Network.
You can use
web3.js or other ethereum tools to interact with Darwinia using Ethereum compactible RPC api.
Note: The currently implemented RPC apis is compatible with Ethereum, but some apis are not yet implemented.
Things Dapp developers must know
block.timestamp instead of
On Ethereum or other EVM-Compatible platform, you may use
block.number in contract, but this is not recommended in CSC. We may introduce CSC 2.0 (The Next Generation of CSC) in the future and export the data from CSC 1.0 to CSC 2.0, which may reset the chain height to zero, so we recommend using
Consensus Related Field
Ethereum uses a consensus protocol named Proof-of-Work (PoW). While CSC uses the Nominated Proof of Stake(NPOS). They are two completely different consensus mechanisms. Consequently, Proof of Work concepts, such as
hashrate, generally is not applicable to CSC. For APIs that return value related to Ethereum’s Proof of Work, default value are returned.
It is particularly important to note that CSC's genesis block does not start at 0 like Ethereum. It is
4969901. This means that if you try to query the block history before
eth_getBlockByHash(), you will get
null. This is because the DVM smart contract solution was added in the middle of the Substrate-base Crab chain, there are no Ethereum transactions in the Substrate history blocks and no corresponding Ethereum history blocks generated.
Ethereum Block Author
The author(miner) of the ethereum block you get from
eth_getBlockByHash() is the last 20 bytes of the actual substrate block author. It's because the ethereum block is built based on substrate block and who's author is a 32-bytes address. We have to truncate to adapt ethereum block needs. Please do not tranfer to the ethereum block author, since the private key of this address is unknown.
Darwinia is EVM-compatiable, so your can use almost all toolchains for EVM. Here are some of our picks: