Konubinix' opinionated web of thoughts

Ethereum Local Development Environment


eth local dev env

I have to work on a project using an hardhat node. And I would like to find out what is put in the blockchain. Having a local explorer would be great.

This are the options I could find,

  • ethernal,

    • waaaay tooo complicated. Uses firebase and other stuff that makes it very hard to understand.
  • blockscout,

    • seems promising,
    • but cannot work because of a tracing issue. Even when enabling hardhat-tracer or disabling the tracing, it still complains
  • https://github.com/blockchain-etl/ethereum-etl to extract the data

    • not compatible with python3.11. I don’t want to be forced to downgrade to a too old version of python3.
  • https://github.com/web3labs/chainlens-free

    • admin_nodeInfo - Method not supported
    • eth_getBlockByNumber (5707) and keeps growing
  • navigating using web3.py.

    Using some code like this:

    from eth_account import Account
    a = Account.from_mnemonic(mnemonic)
    from web3 import Web3
    w3 = Web3(Web3.HTTPProvider(''))
    from web3.middleware import construct_sign_and_send_raw_middleware
    c = w3.eth.contract("address", abi=json.loads(Path(".../contracts/X.sol/X.json").read_text())["abi"])

chainlens and blockscout did not work with hardhat, because apparently some tracing features where missing.

By moving to ganache, chainlens and blockscout worked like a charm.

It was as simple as calling:

ganache --server.host --wallet.mnemonic "${mnemonic}"

To run chainlens, I did.

git clone https://github.com/web3labs/chainlens-free
cd chainlens-free/docker-compose
NODE_ENDPOINT= docker-compose up

And to run, blockscout,

git clone https://github.com/blockscout/blockscout
cd blockscout/docker-compose
docker-compose -f docker-compose-no-build-ganache.yml up

contract verification

Only blockscout allows to verify the smart contract, so that I can play with it in the browser. That is quite nice.

To do so, I need to flatten it

npx hardhat flatten contracts/X.sol > X.sol

verifying a contract issued by a factory

This is apparently possible with blockscout, but not with ganache

@nisarg2023 it is not currently possible with Ganache. You should run any of these: Erigon, Reth, Geth, Nethermind, OpenEthereum with enabled tracing module.


finding the correct technology

Ok, so hardhat was to limited to be scanned properly. With ganache, things where better, but I could still find use case that I could not do.

The suggested candidates are

  • Erigon,
  • Reth,
  • Geth,
  • Nethermind,
  • OpenEthereum with enabled tracing module.

I could only make reth work in development mode, and yet I figured out I could not call the increaseTime function.

clarifying what I want

After this exploration, it is time to try to write down what I want.

  1. a blockchain that can:
    1. easily run in single node,
    2. have prefilled accounts with chosen private key (using a mnemonic would be a comfortable addition),
  2. easily move forward in time (like using evm_increaseTime) to test time dependant contracts,
  3. providing the necessary features to be introspected using a block explorer with the features
    1. automatic detection of known contracts (like ERC-20),
    2. possibility to verify the code,

my options

I appears that there is a dichotomy in the ethereum world for now. Blockchains are either production ready and feature-full, but not appropriate for development mode. Or the opposite.

hardhat ganache erigon reth geth nethermind openethereum
evm_increaseTime yes yes no no no no no
easy dev mode yes yes no almost no no no
blockscout no almost yes yes yes yes yes