PoWStamp

powstamp · receipt-attestation · 368 B runtime · registry-info

scores

source

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

contract PoWStamp {
    uint256 public constant TARGET = 2**240;

    event Stamp(
        address indexed sender,
        bytes32 indexed payload,
        uint256 nonce,
        uint256 blockNumber,
        bytes32 hash
    );

    function stamp(bytes32 payload, uint256 nonce) external {
        bytes32 h = keccak256(abi.encodePacked(block.chainid, block.number, payload, msg.sender, nonce));
        require(uint256(h) <= TARGET);
        emit Stamp(msg.sender, payload, nonce, block.number, h);
    }
}