← Back to HashNotary
Smart Contract
HashNotary's certifications are powered by a smart contract deployed on the Polygon blockchain. This page provides transparency about how your document seals are recorded on-chain.
How It Works
1. Hash Generation (Client-Side)
Your browser uses the WebCrypto API to generate a SHA-256 hash of your document. This hash is a 64-character hexadecimal string that uniquely identifies your file.
2. On-Chain Recording
The hash, along with a timestamp and your certifier address, is sent to our smart contract on Polygon. The contract records this data in an immutable mapping.
3. Verification
Anyone can query the smart contract with a document hash to verify its certification status, timestamp, and certifier address — without needing a HashNotary account.
Contract Architecture
// SPDX-License-Identifier: MIT
// HashNotary Document Certification Contract
contract HashNotary {
struct Certification {
address certifier;
uint256 timestamp;
bytes32 documentHash;
bool exists;
}
mapping(bytes32 => Certification) public certifications;
event DocumentCertified(
bytes32 indexed documentHash,
address indexed certifier,
uint256 timestamp
);
function certify(bytes32 _hash) external {
require(!certifications[_hash].exists, "Already certified");
certifications[_hash] = Certification(
msg.sender,
block.timestamp,
_hash,
true
);
emit DocumentCertified(_hash, msg.sender, block.timestamp);
}
function verify(bytes32 _hash) external view
returns (bool, address, uint256)
{
Certification memory cert = certifications[_hash];
return (cert.exists, cert.certifier, cert.timestamp);
}
}
Verify On-Chain
You can independently verify any HashNotary certification by querying the Polygon blockchain directly through:
- PolygonScan — Polygon's official block explorer
- Any Ethereum-compatible RPC endpoint
- Web3.js, Ethers.js, or any blockchain library
Transparency Commitment: Our smart contract is verified and open-source on PolygonScan. Anyone can audit the code and verify that it does exactly what we claim — nothing more, nothing less.