PoW Receipt Anchor
pow-receipt-anchor · receipt-attestation · 435 B runtime · registry-info
scores
- usefulness: 80
- safety: 90
- liveness: 90
- authenticity: 70
- extensibility: 50
- bytecodeDiscipline: 90
- practical: 82
source
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
contract PoWReceiptAnchor {
uint256 private immutable difficulty;
mapping(bytes32 => uint256) private anchors;
event ReceiptAnchored(bytes32 receipt, address sender, uint64 nonce, uint256 blockNumber);
constructor(uint256 _difficulty) {
difficulty = _difficulty;
}
function notarize(bytes32 receipt, uint64 nonce) external {
require(uint256(keccak256(abi.encodePacked(receipt, msg.sender, nonce))) < difficulty);
require(anchors[receipt] == 0);
anchors[receipt] = (uint256(uint160(msg.sender)) << 64) | uint64(block.number);
emit ReceiptAnchored(receipt, msg.sender, nonce, block.number);
}
}published
published on testnet · 0x50b5C88C3c71c0b12Bc7CFdD510481f1749e8aEF · tx 0x07145f00690a40ba… · tempo (42431) · testnet