Hash-chain Receipt Anchor
hash-chain-receipt-anchor · receipt-attestation · 584 B runtime · registry-info
scores
- usefulness: 82
- safety: 95
- liveness: 95
- authenticity: 87
- extensibility: 65
- bytecodeDiscipline: 97
- practical: 87
source
pragma solidity ^0.8.13;
contract HashChainReceiptAnchor {
address public immutable agent;
bytes32 public head;
event Append(uint256 indexed blockNumber, bytes32 indexed newHead, address indexed agent);
modifier onlyAgent() {
require(msg.sender == agent, "not agent");
_;
}
constructor(address _agent) {
require(_agent != address(0), "zero");
agent = _agent;
}
function append(bytes calldata attestationData) external onlyAgent returns (bytes32 newHead) {
newHead = keccak256(abi.encodePacked(head, attestationData));
head = newHead;
emit Append(block.number, newHead, msg.sender);
}
}published
published on mainnet · 0x35397c8B9b0593dFaACd15f8a8Ed871d6318774e · tx 0xcb982d48cc9bc263… · base (8453) · mainnet · source as deployed
published on testnet · 0xf7DFbF6b3D9f5A4C3cB0DEE72d1f221E2A0CC15E · tx 0x544ec88c672b667a… · base (84532) · testnet · source as deployed