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)-
Foundry (
forge,cast) -
The file to inscribe at
data/text-to-inscribe.md(must be under 100 KB) -
foundry.tomlmust allow the script to read the data directory:fs_permissions = [{ access = "read", path = "./data" }]
Generate a fresh keypair:
forge script script/CreateWallet.s.solThis 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 --interactiveVerify the import:
cast wallet address --account inscriberNever fund a key that has been printed in a shared terminal, chat, or CI log. Generate and import the key locally.
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>Dry-run first (simulation only, nothing is sent):
forge script script/Inscribe.s.sol --rpc-url <rpc-url> --account inscriberThen broadcast for real:
forge script script/Inscribe.s.sol --rpc-url <rpc-url> --account inscriber --broadcastYou'll be prompted for the keystore password. The transaction hash is written
to broadcast/Inscribe.s.sol/<chain-id>/run-latest.json.
Fetch the transaction's calldata and decode it:
cast to-utf8 $(cast tx <tx-hash> input --rpc-url <rpc-url>)