web3-protocol / evm-browser

Web browser with support of the ERC-4804 / ERC-6860 web3:// protocol, which can show on-chain websites hosted on Ethereum and all others EVM chains.
MIT License
32 stars 3 forks source link

EVM Browser

Web browser with support of the ERC-4804 / ERC-6860 web3:// protocol, which can show on-chain websites hosted on Ethereum and all others EVM chains. It includes support for the Frame.sh wallet.

./screenshot2.png

As an example, web3://terraformnavigator.eth/ is an on-chain website served by a smart contract, which interacts with the Terraform NFT contract : pages are generated dynamically, these are not static pages.

The browser works out of the box with all chains (providers are given by viem.sh and chainid.network) and support the Frame.sh wallet. The browser is forked from the great electron-as-browser from hulufei.

In the above example, clicking on a terraform will load a dynamic page, for example :

web3://terraformnavigator.eth/view/9352

./screenshot3.png

More examples :

web3://0x4E1f41613c9084FdB9E34E11fAE9412427480e56/tokenHTML/9352

Call the tokenHTML method of 0x4E1f41613c9084FdB9E34E11fAE9412427480e56, and gives the uint 9352 as an argument.

web3://0x4E1f41613c9084FdB9E34E11fAE9412427480e56/tokenSVG/9352?mime.type=svg

Call the tokenSVG method of 0x5a985f13345e820aa9618826b85f74c3986e1463, gives the uint 9352 as an argument, and return the result as image/svg+xml.

web3://0xA5aFC9fE76a28fB12C60954Ed6e2e5f8ceF64Ff2/levelAndTile/2/50?returns=(uint256,uint256)

Returns 2 numbers from this contract method, whose arguments are 2 and 50. The output will be casted as JSON : ["0x1","0x24"]

web3://usdc.eth/balanceOf/vitalik.eth?returns=(uint256)

Call the balanceOf method of usdc.eth with vitalik.eth resolved to this address as an argument.

See the web3:// protocol documentation for more infos.

Wallet support

EVM Browser also ships with Frame.sh wallet and local node wallet support, which allows us to have a full read+write experience!

This is thanks to eth-provider, which is exposed on window.ethereum

Web3 domain support

EVM Browser support .eth ENS domains and .og Linagee domains.

Current limitations

Usage

evm-browser

By default it will use the ethereum providers embedded with the viem.sh library.

If you want to use your own web3 provider for mainnet : evm-browser --chain-rpc 1=https://eth-mainnet.alchemyapi.io/v2/<your-alchemy-key>

Add or override multiple chains : evm-browser --chain-rpc 42170=https://nova.arbitrum.io/rpc --chain-rpc 5=http://127.0.0.1:8545

Show the devtools : evm-browser --debug

Install from source

yarn install

Usage from source

yarn start

If you want to use your local evm node for sepolia : yarn start -- -- --chain-rpc 11155111=http://127.0.0.1:8545 (the -- -- is nedded to skip electron-forge then yarn)

Debugging

All calls to web3:// are returned with debugging headers, visible in the devtools, to help understand what is happening.