EVM Demo

Start by deploying a contract:

  • Choose a new 256-bit ID: pick a number like 42 and type z 42 into the hex helper. Click "Hex" and paste the output into the "caller" field.

  • Run coinExample to show the byte code of the example coin contract from Remix. Paste this hex into the "data" text area.

  • Leave the value and contract fields as 0s and click "Send". This deploys the coin contract using the given caller ID. Click "Refresh" to see the changes. You may need to wait for the EVM canister to update.

Call its minter() method:

  • Run h(z 42 ++ z 0) to compute the address of the contract just created, and paste this into the "contract" field.

  • Run method "minter()" to show its 4-byte signature, and paste it into the "data" field.

  • Click "Send" to run the minter() method. Refreshing should show your ID as the result of your last call.

Send some tokens:

  • Run method "mint(address,uint256)" ++ z 123 ++ z 456, paste the result into the "data" field and click "Send". This mints 456 tokens for address 123.

  • Run method "send(address,uint256)" ++ z 124 ++ z 5, paste the result into the "data" field and click "Send". This should fail.

  • Paste the previous hex into the "data" field again, but this time also paste the result of z 123 into the "caller" field. Click "Send". Now that the caller ID is correct, this should transfer 5 tokens to address 124.

  • Send the hex of method "balances(address)" ++ z 124 to confirm. This should work with any caller ID.

Hex Helper

A custom language for producing hex strings. Examples:

z 123              -- Write 123 as 256-bit big-endian.
h ""               -- Keccak-256 hash of empty string.
h(z 0x1a2 ++ z 2)  -- Address of contract #2 deployed by 0x1a2.
method "minter()"  -- Method hash of "minter()"
take 4 (h "minter()")  -- Alternative equivalent.
unxxd "123abc"     -- Hex-encoded string.
coinExample        -- Bytecode of example coin contract.

Output:


Dear EVM,

(The creation pseudo-contract has ID 0.)

Queries