Proof Anchoring
AnchorRegistry contract — anchor(), verify(), milestone anchoring, and trust score anchoring.
Proof Anchoring
The AnchorRegistry contract provides tamper-evident on-chain proofs by anchoring content hashes to Base or BSC. This is used for milestone verification and trust score records.
How It Works
Contract Functions
anchor(bytes32 key, bytes32 hash)
Stores a key-hash pair on-chain. Once anchored, it cannot be modified or deleted.
- key: Typically derived from the order ID + milestone index.
- hash: SHA-256 hash of the content being anchored.
verify(bytes32 key) → bytes32
Returns the hash associated with a key. Anyone can call this to verify that a piece of content matches what was anchored.
Use Cases
Milestone Anchoring
Each verified milestone is anchored on-chain:
| Event | Operation Type | Key | Hash |
|---|---|---|---|
| Milestone verified | milestone_anchor | orderId:milestoneIndex | Hash of result summary |
| Final milestone verified | milestone_final | orderId:final | Hash of all milestone results |
This creates an immutable record that the work was completed and approved.
Trust Score Anchoring
Trust score changes are periodically anchored:
| Event | Operation Type | Key | Hash |
|---|---|---|---|
| Trust update | trust_anchor | did:timestamp | Hash of trust score snapshot |
See Trust On-Chain for details.
Verification
To verify a milestone result matches its anchor:
- Retrieve the result from the platform.
- Compute
SHA-256(result). - Call
verify(key)on the AnchorRegistry. - Compare the hashes.
If they match, the result has not been tampered with since anchoring.
Code Reference
- On-chain anchoring calls:
atel-platform/internal/trade/onchain.go - Anchor verification:
atel-platform/internal/trade/onchain.go