ABI
ENC

ABI Playground

Mar 9, 2022

ABI Playground is a tool that allows for quick and easy interacting with deployed contracts without a verified source.

This is what the interface looks like:

demo

You can click on the ?-symbol next to the title to fill in the example for you. It enters in the contract address of TheDAO and a few functions as an example.

demo

The ABI-section allows you to fetch the ABI from etherscan if it's available or import common ABIs.

demo

You can either enter a full ABI in JSON format, or you can simply write function declarations yourself, like in the example.

demo

The Functions section is generated automatically from the ABI. To send a request, click on the function name. The function's arguments are in between the parentheses along with their variable names if given. If a variable is of type address, the *-symbol can be used to insert your own address.

Once the ABI and an address has been entered, the contract (along with the ethers library) can also be accessed by opening up the developer console.

demo

The variables after the arrow are the returned variables. Note that, only constant (i.e. non-state-modifying/view) functions will return data.

  • View functions are marked blue
  • State-modifying functions are marked orange
  • Payable functions are in red

In order to receive an output from a state-modifying function (orange and red) they need to be called as a static request. This can be achieved by either changing the definition in the ABI, i.e. adding the view declaration. Or this can be done in the Low-Level Call section. The Low-Level Call data is automatically updated by modifying function arguments, or by clicking on the icon to the left of a function.

demo

This section shows the full transaction data that is submitted and can be directly modified. It can therefore also be used for deploying contracts by copying the deployment bytecode or it can be used to directly execute raw bytecode. This can come in handy for some of the Ethernaut challenges.

demo

The response is decoded if any return values were specified. Individual values can be copied by clicking on the types to the left.

demo

The full response (broken up in 32 bytes chunks) can be inspected in the Low-Level Call section. The raw data can be copied by clicking on 'data' on the top.

Try it out! I'm happy for any feed-back.

Special thanks to the team developing the ethersjs. This is just a fancy interface built on-top of it.