ChainProof

A trading bot that writes every decision to Ethereum, so anyone can check it later.

I built a rule-based BTC trading bot and replayed it over 2024. It made 30 decisions. For each one, the inputs and the decision were hashed (keccak256), signed with a dedicated key (ECDSA) and stored in a contract on the Sepolia testnet, where they can't be edited.

The button checks all 30 from your browser: it hashes the published data itself, reads the stored records straight from Sepolia and checks who signed them. This server only sends the data, so you don't have to trust it.

Contract on Etherscan

Takes about 10 seconds. You don't need a wallet.

What's in the project

  • A Solidity contract on Sepolia holding 30 signed decision records.
  • An ERC-8004 agent identity (agent #9896). ERC-8004 is a draft standard for on-chain AI agents. The official deployments don't include a Validation Registry, so I wrote and deployed one, along with a validator that only accepts results for decisions that are already on-chain.
  • While testing against the live registry I found a mismatch: the reference Validation Registry calls agentExists(), which the deployed Identity Registry doesn't have, so it reverts. Mine uses isAuthorizedOrOwner() instead. Details are in the README.
  • 33 automated tests that run on every push: 19 in Foundry (including fuzz tests and tests against forked Sepolia) and 14 in Python.
  • The trading logic: RSI, MACD, SMA 20/50 and Bollinger Bands each vote, and the bot trades when two agree. Stop-loss and take-profit are included.

The 30 decisions

BTC price at each decision. Use "Details" on a row to see exactly what was hashed and signed.

Entry Exit

Try changing one

Edit any field of a decision and its hash will no longer match the one stored on-chain. Put the original value back and it matches again.

Hash stored on Sepolia Loading…
Hash of your edited version …

Backtest results

Best of 48 parameter sets for each asset. These are in-sample numbers, so treat them with caution. Only the BTC decisions are stored on-chain.

AssetReturnWin rateSharpeStop-loss / take-profit

ERC-8004 records

Reading the validation record from Sepolia…

What your browser actually runs

The whole check is a few lines of ethers.js, done once per decision:

// 1. hash the published decision (sorted-key JSON, no spaces)
const myHash = ethers.keccak256(ethers.toUtf8Bytes(decision.canonical));

// 2. read what was stored on-chain at the time
const [storedHash, , , signer, signature] = await registry.getCommitment(i);

// 3. both must hold
myHash === storedHash;
ethers.verifyMessage(ethers.getBytes(storedHash), signature) === CHAINPROOF_KEY;

The full script is on GitHub.

Run the check from a terminal

Same check in Python, from a fresh clone. No keys or config needed.

git clone https://github.com/Zenish2001/ChainProof.git
cd ChainProof/verification-layer
pip install -r requirements.txt
python verify.py

Limits

This shows that the 30 published decisions are exactly the ones stored on-chain, and that they were signed by the ChainProof key. It does not show that the strategy is profitable, that the parameters weren't chosen after the fact, or that no decisions were left out. It's a replay of historical data, not live trading, and the signing key is a local key rather than a hardware enclave. The README goes into more detail.