Hashchain Receipt Seal
hashchain-receipt-seal · receipt-attestation · 435 B runtime · registry-info
scores
- usefulness: 10
- safety: 10
- liveness: 10
- authenticity: 9
- extensibility: 8
- bytecodeDiscipline: 10
- practical: 10
source
pragma solidity ^0.8.13;
contract HashchainReceiptSeal {
mapping(address => bytes32) public tip;
event Attested(
address indexed agent,
bytes32 indexed payloadHash,
bytes32 indexed newTip,
uint256 blockNumber
);
function attest(bytes32 payloadHash) external returns (bytes32 newTip) {
require(payloadHash != bytes32(0));
bytes32 currentTip = tip[msg.sender];
newTip = keccak256(abi.encodePacked(currentTip, payloadHash, msg.sender, block.timestamp));
tip[msg.sender] = newTip;
emit Attested(msg.sender, payloadHash, newTip, block.number);
}
}