Countersign alpha

Stop blind signing.

Read the transaction on a second screen before you sign it.

A command-line tool for people who run agents and sign with a hardware wallet. The agent stages the transaction in the terminal. Your phone decodes the raw bytes on its own. You approve on the device when the two hashes match.

npm install -g csign Open the verifier
The verifier runs on your phone. Scan to open it there. The page then shows how to add it to the home screen.
Terminal not relied on
agent csign stage tx --to 0x8617…070D --sig 'transferOwnership(address)' -- 0x5290…9EE7
      staged 9c41d2a07b3e. Nothing signed.
you   csign sign 9c41d2a07b3e
From the computer by QR code
raw fields, nothing else
Countersign
Call
transferOwnership
On contract
0x8617E340B3D01FA5F11F306F4090FD50E238070D
newOwner
0x52908400098527886E0F7030069857D2E4169EE7
Hash to match
40defafb76a02fa1cb679e5bbf3dfb2313fa31827830479b39839e0f6cf39964

Your phone reads the call

From the computer by USB
the same bytes
Review transaction
Transaction hash
40defafb76a02fa1cb679e5bbf3dfb2313fa31827830479b39839e0f6cf39964
Hold to sign

Your hardware wallet shows a hash

The same hash on both screens: what you read on the phone is what gets signed. Any difference: reject on the device.

Why

How it works

  1. Stage

    csign stage tx …

    Run by the agent. Fixes every field: nonce, gas limit, fees. Simulates the transaction, signs nothing, prints an id.

  2. Sign

    csign sign <id>

    Run by you. The raw transaction appears as an animated QR code while the wallet waits with exactly the staged bytes.

  3. Read

    on the phone

    The verifier recomputes the hash with its own code and decodes the call and any batch inside it. A bundle carrying a label or description is refused.

  4. Approve

    on the device

    When the hashes match. The signed result is kept only if it equals the staged transaction field by field, then published.

Plain transactions, contract deployments, Safe owner signatures and Safe executions, on Ethereum, Base, BNB Chain, X Layer and GenLayer. For an agent, the whole brief is one file: AGENTS.md.

Threat model

Relied on

  • The hardware wallet: its key, and what its own screen shows.
  • The phone and the verifier page on it. The page computes the hash with code that shares nothing with the computer's.
  • Your own eyes on two screens.

Not relied on

  • The computer.
  • The agent or person who prepared the transaction.
  • csign itself, and anything it prints.
  • Any app front end. None is in the path.

Why it holds

The wallet signs exactly the bytes whose hash it displays. The phone shows what those bytes do and what their hash is. If the two hashes match, what you read on the phone is what gets signed, whatever the computer did. To cheat, an attacker has to control the computer and the phone at once.

From one break-in to two

A compromised computer is the case that matters: an agent gone wrong, a bad package, malware. What happens next depends on whether anything else can read the transaction.

  • ✕ ComputerNo second screen

    Without Countersign. The wallet cannot clear-sign the call, so you approve a hash you cannot read. One break-in is enough.

    Signed
  • ✕ Computer✓ Phone

    With Countersign. The phone shows what the hash really stands for. The wrong call or address is on its screen, and you reject.

    Caught
  • ✕ Computer✕ Phone

    With Countersign. The phone lies to match the tampered transaction. This is the one way through, and it takes both at the same moment.

    Not protected

The computer here means everything on it: the agent, csign and the packages it came with. The hardware wallet is the one part assumed sound.

Two ways to open the verifier

From this site

The verifier is one file with no outside code. Your phone saves it on first use, only if it matches its published hash, and runs that copy from then on, offline too. A new version shows both hashes and waits for you.

The limit: a website cannot pin itself against its own server. Whoever controls this site, its domain or its repository could replace the page.

From IPFS

On IPFS the address is a hash of the page. That address can only ever show that exact page, and nobody, us included, can change what it serves. A new version is a new address. The page tells you when one exists and you move to it when you choose.

bafybeicvybpg6ymbvijpxdhlzzlapoig5m2wqnogriqljr3ybihmwlluwu

The limit: your browser reaches IPFS through a gateway, which supplies the script that checks the page against the address.

Either way the page is only half of the pair. A swapped verifier can lie about what a transaction does. It cannot change what the wallet signs.

It needs a wallet with its own screen that shows a hash. Signing on a Ledger has been run by hand; a Trezor goes through Foundry's cast and has not been run yet. The first load of the verifier on a phone trusts the server. The security model in the repository lists where it stops.

Install

# needs Node 20 or later and Foundry
npm install -g csign

# on the phone: add to the home screen, open only from that icon
https://countersign.genlayer.foundation/verify/

# on a Ledger: Ethereum app, Settings, always show the transaction hash