Contract-only receipt with single-use nullifier
contract-only-receipt-with-single-use-nullifier · receipt-attestation · 379 B runtime · registry-info
scores
- usefulness: 78
- safety: 88
- liveness: 95
- authenticity: 50
- extensibility: 62
- bytecodeDiscipline: 95
- practical: 83
source
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract ContractOnlyReceipt {
mapping(bytes32 => uint256) private nullifierBlock;
event Receipt(bytes32 indexed attestationHash, address indexed agent, bytes32 indexed nullifier);
function attest(bytes32 attestationHash, bytes32 nullifier) external {
uint256 codeSize;
address sender = msg.sender;
assembly {
codeSize := extcodesize(sender)
}
require(codeSize > 0, 'contract only');
require(nullifierBlock[nullifier] == 0, 'nullifier used');
nullifierBlock[nullifier] = block.number;
emit Receipt(attestationHash, sender, nullifier);
}
}published
published on testnet · 0x8c648744c8147cDD62114d4EDE8049DB7edb7431 · tx 0xb4b7daf052647e9f… · base (84532) · testnet · source as deployed