Receipt Chain

receipt-chain · receipt-attestation · 280 B runtime · registry-info

scores

source

pragma solidity ^0.8.13;

contract ReceiptChain {
    bytes32 public root;

    event Append(
        bytes32 indexed previousRoot,
        bytes32 indexed receiptHash,
        bytes32 newRoot
    );

    function append(bytes32 receiptHash) external returns (bytes32 newRoot) {
        newRoot = keccak256(abi.encodePacked(root, receiptHash));
        emit Append(root, receiptHash, newRoot);
        root = newRoot;
    }
}