julienbrg/inscribe

Inscribe a markdown file onto Ethereum as transaction calldata

★ 1Forks 0SolidityGitHub ↗Compare

README

Inscribe

Inscribe a markdown file onto Ethereum as transaction calldata. The Inscribe script reads data/text-to-inscribe.md and sends a 0 ETH transaction from your address to itself, with the file contents as calldata — permanently recording it on-chain.

Inspired by this transaction. You can read it too:

cast to-utf8 $(cast tx 0x5dd574df963a1df1f064791e0f6ff41ec972cdbba12293b7e1ece582052ba855 input --rpc-url flashbots)

Prerequisites

  • Foundry (forge, cast)

  • The file to inscribe at data/text-to-inscribe.md (must be under 100 KB)

  • foundry.toml must allow the script to read the data directory:

    fs_permissions = [{ access = "read", path = "./data" }]

1. Create a wallet

Generate a fresh keypair:

forge script script/CreateWallet.s.sol

This prints a new address and private key (nothing is saved to disk). Import the key into Foundry's encrypted keystore — paste the private key when prompted and choose a password:

cast wallet import inscriber --interactive

Verify the import:

cast wallet address --account inscriber

Never fund a key that has been printed in a shared terminal, chat, or CI log. Generate and import the key locally.

2. Fund the address

Send ETH to the new address to cover gas. Calldata costs ~16 gas per non-zero byte, so a 30 KB file costs roughly 500k gas on top of the 21k base. Estimate the actual cost:

cast estimate <your-address> --from <your-address> \
  $(cast from-utf8 "$(cat data/text-to-inscribe.md)") \
  --rpc-url <rpc-url>

3. Inscribe

Dry-run first (simulation only, nothing is sent):

forge script script/Inscribe.s.sol --rpc-url <rpc-url> --account inscriber

Then broadcast for real:

forge script script/Inscribe.s.sol --rpc-url <rpc-url> --account inscriber --broadcast

You'll be prompted for the keystore password. The transaction hash is written to broadcast/Inscribe.s.sol/<chain-id>/run-latest.json.

Reading the inscription back

Fetch the transaction's calldata and decode it:

cast to-utf8 $(cast tx <tx-hash> input --rpc-url <rpc-url>)

Contributors

julienbrg

Issues