The extension includes:
- a content script
- a background script
The extension is activated when a user navigates to a web3 enabled web app (i.e. which uses Metamasks window.ethereum).
Peekablock uses the same mechanism as Metamask to attach to window.ethereum (specifically the function window.ethereum.request), and sends a notification to the background script without modifying the transaction sent to metamask.
When the page suggests a transaction to sign, peekablock forwards the transaction to an api to execute the transaction from the point of view of the user, and show the effects it would have if it were executed immediately on the blockchain.
Such an extension is critical to avoid scams, because it shows clearly and in a human readable manner the effects of what the user is signing.
When a transaction is proposed for approval, peekablock shows the effects generated by the transaction on a forked mainnet, for now these events are supported:
- Ethereum transfer
- ERC20/ERC721 transfer
- ERC20/ERC721 approval
- ERC721 approval for all
Please run the following commands:
npm i
npm run build
web-ext build
Then run
npm run set-chrome
or
npm run set-firefox
for setting respectively chrome or firefox version