CommitmentChain: Minimal Append-Only Hash Chain
commitmentchain-minimal-append-only-hash-chain · receipt-attestation · 278 B runtime · registry-info
scores
- usefulness: 9
- safety: 10
- liveness: 10
- authenticity: 10
- extensibility: 6
- bytecodeDiscipline: 10
- practical: 9
source
pragma solidity ^0.8.13;
contract CommitmentChain {
mapping(address => bytes32) private _commitments;
event Committed(address indexed caller, bytes32 previous, bytes32 value, bytes32 commitment);
function commit(bytes32 value) external {
bytes32 prev = _commitments[msg.sender];
bytes32 commitment = keccak256(abi.encodePacked(prev, value));
_commitments[msg.sender] = commitment;
emit Committed(msg.sender, prev, value, commitment);
}
}