Document-Token Binding
The core innovation that permanently links ERC tokens to real-world documents.
Overview
Document-Token Binding is Integra’s foundational architecture that creates a permanent, cryptographic link between blockchain tokens and the real-world documents they represent. Unlike traditional NFTs that store only metadata, Integra tokens are bidirectionally bound to their source documents, ensuring that every token can prove its authenticity and every document knows its associated tokens.
The Two-Layer Architecture
Layer 1: Document Registry
The Document Registry establishes permanent document identity:
struct Document {
bytes32 integraHash; // Unique document identifier
bytes32 documentHash; // SHA-256 of document content
bytes32 referenceHash; // IPFS CID or storage reference
address owner; // Document controller
address tokenizer; // Associated tokenizer contract
}Key properties:
integraHashis permanent and uniquedocumentHashproves content hasn’t changed- One document can have multiple tokens (via ERC-1155)
Layer 2: Tokenizer Contracts
Tokenizers mint standard ERC tokens bound to documents:
// Bidirectional mapping in all tokenizers
mapping(bytes32 => uint256) public integraHashToTokenId;
mapping(uint256 => bytes32) public tokenIdToIntegraHash;This ensures:
- Every token knows its document (
tokenIdToIntegraHash) - Every document knows its tokens (
integraHashToTokenId) - The binding is immutable once established
How Binding Works
Registration Flow
1. User creates document
↓
2. Hash document content (SHA-256)
↓
3. Register in Document Registry
↓
4. Receive integraHash (unique ID)
↓
5. Tokenizer creates token slot
↓
6. Token permanently linked to integraHashVerification Flow
1. Someone receives token
↓
2. Look up integraHash from token
↓
3. Query Document Registry
↓
4. Get documentHash and referenceHash
↓
5. Fetch document from storage
↓
6. Verify hash matches
↓
7. Document authenticity confirmedThe integraHash
Every document gets a unique identifier:
integraHash = keccak256(abi.encodePacked(
documentHash, // Content hash
referenceHash, // Storage reference
msg.sender, // Registrant
block.timestamp // Registration time
));Properties:
- Globally unique across all chains
- Deterministic given inputs
- Cannot be predicted before registration
- Permanent and immutable
Why Binding Matters
Traditional NFTs
Token Metadata → {"image": "ipfs://...", "name": "..."}
↑
Can be changed
No proof of underlying asset
Anyone can create fakeIntegra Tokens
Token → integraHash → Document Registry → documentHash → Real Document
↑ ↑
Permanent link Cryptographic proof
Cannot be broken Content verifiedVerifying Ownership
Simple Verification
// Get document info from token
const integraHash = await tokenizer.tokenIdToIntegraHash(tokenId);
const doc = await registry.getDocument(integraHash);
// Verify document content
const storedHash = doc.documentHash;
const actualHash = sha256(documentContent);
const isAuthentic = storedHash === actualHash;Complete Verification
import { verifyDocument } from '@integra/sdk';
const result = await verifyDocument({
tokenId,
tokenizer: ownershipTokenizerAddress,
documentContent,
});
console.log(result.isAuthentic); // true/false
console.log(result.owner); // Current owner
console.log(result.registrationDate); // When registeredUse Cases
Property Deeds
Property Deed PDF → documentHash → Registry → NFT
↓
Anyone can verify: "This NFT represents THIS specific deed"Rental Agreements
Lease Agreement → documentHash → Registry → Landlord Token + Tenant Token
↓
Both parties can prove: "We are parties to THIS agreement"Certificates
Diploma → documentHash → Registry → Soulbound Token
↓
Employer can verify: "This credential represents THIS diploma from THIS school"Technical Deep Dive
Why Two Hashes?
documentHash: Proves the exact content
// SHA-256 of actual document bytes
bytes32 documentHash = sha256(documentContent);referenceHash: Points to storage location
// IPFS CID where document is stored
bytes32 referenceHash = ipfsCIDToBytes32(cid);Why both?
documentHashcan verify ANY copy of the documentreferenceHashtells you WHERE to get the document- Separation allows storage flexibility
Immutability Guarantees
Once a document is registered:
- integraHash cannot change - Derived from registration inputs
- documentHash cannot change - Stored immutably
- Token binding cannot change - Set once during claim
- Only ownership can transfer - As expected for property rights
Best Practices
Document Preparation
- Finalize document before registration
- Use consistent hashing algorithm (SHA-256)
- Store document in permanent storage (IPFS, Arweave)
- Keep local backup of original
Verification
- Always verify documentHash matches
- Check registration timestamp
- Verify tokenizer is legitimate
- Confirm owner identity through attestations
Related Documentation
- Document Registry - Core registry contract
- Tokenizer Overview - How tokenizers work
- Privacy Architecture - Privacy considerations
- Reserve-Claim Pattern - Token distribution