Harbor
Blockchain Finality Layer
The problem Harbor solves
Small blockchains get robbed. Not through smart contract bugs or phishing —
through math.
If you control 51% of a chain's mining power, you control its history.
You can mine a secret alternative chain, make a transaction on the real one
(buy something, withdraw funds), then release your private chain and erase that transaction like it never happened. The chain accepts your version because it's longer. You keep the money AND the thing you bought.
Ethereum Classic lost $5.6M this way. The attack cost ~$50,000.
That's a 112x return on crime. And ETC is not even a small chain.
The real targets are the hundreds of chains sitting online right now with
< $1M in mining security — gaming chains, DeFi protocols on custom L1s,
app-specific chains. Anyone with a NiceHash account and a weekend can
attack them.
Harbor fixes this by making the past immutable.
Every 10 blocks, Harbor takes the small chain's block hash and writes it
permanently to a smart contract on a stronger chain (Ethereum). Once written, that hash cannot be changed — not by us, not by anyone.
Now if an attacker tries to submit an alternative chain, Harbor's validator
checks the incoming blocks against those stored hashes. Different hash?
The chain is rejected. Automatically. At the protocol level.
The attack doesn't get detected. It doesn't get flagged. It just doesn't work.
No chain modifications needed. No new consensus mechanism. No $30M masternode network. Just a notary bot, a smart contract, and one 'docker compose up'.
Challenges we ran into
The two-chains-one-Hardhat problem
Hardhat isn't built to run two independent nodes from the same project.
When I tried spinning up both the fortress chain (':8545') and small chain (':8546') simultaneously, they shared chain state and interfered with each other's artifacts.
It took a while to realize that the fix was spawning them as completely separate child processes inside setup-chains.js and treating the port number itself as the chain identifier in the contract.
Felt hacky.
Worked perfectly.
The notary bot kept double-anchoring
WebSocket block event listeners on local Hardhat nodes sometimes fire duplicate events — the same block appearing twice within milliseconds.
The contract throws 'BlockAlreadyAnchored' if the same height is written again, so the notary bot kept crashing mid-run with revert errors.
The fix was embarrassingly simple:
check 'isAnchored()' before sending the transaction.
If the block is already anchored, skip it silently.
Adding that one check made the bot run stable for the first time.
Docker startup ordering
'depends_on' in Docker Compose only checks whether the container has started, not whether Hardhat is actually listening or if the contract has been deployed.
Because of this, the notary bot consistently crashed on startup with a "contract not found" error since it started before deployment finished.
The solution was creating 'ensure-deploy.js' as a startup gate.
The script:
- Polls port '8545' until Hardhat responds.
- Deploys 'HarborRegistry'.
- Writes the contract address to '.env'.
- Only then starts the notary bot.
After that, deployment became completely deterministic.
Making the attack simulation actually real
I didn't want to fake the attack result in the UI.
The contract read needed to return a real mismatch.
So the simulator generates a fake hash using:
'javascript'
keccak256("ATTACK_" + blockHeight)