Web3 Modes
| Mode | Name | Description | Use Case |
|---|---|---|---|
W0 |
None | No Web3 integration | Traditional applications |
W1 |
File-Signed | File-level digital signature | Document notarization, single signer |
W2 |
Row-Signed | Per-row signatures | Multi-party, per-record provenance |
Wallet Signatures
Supported Algorithms
Ed25519
Modern, fast elliptic curve. Recommended for new applications.
- 64-byte signatures
- High performance
- No nonce required
secp256k1
Ethereum/Bitcoin compatible. Use for blockchain integration.
- 65-byte signatures (with recovery)
- EVM compatible
- MetaMask support
File-Level Signature (W1)
@dtlv1.0^dtFN^pContract^c0^s1^w1^filehash @sec^blake3^0xABCD...1234^0xSIG123...ABC^ETH │ │ │ │ │ └─ Chain ID │ └─ Signature (hex) └─ Signer wallet address # Tables inherit file-level signature TRANSACTIONS|id:s,amount:f,timestamp:T|2|S1|W1|C0 TX001|1000.00|2025-01-03T10:00:00Z TX002|2500.00|2025-01-03T11:00:00Z
Row-Level Signatures (W2)
@dtlv1.0^dtFN^pMultiSig^c0^s1^w2^multihash @sec^blake3^0x0^none^ETH # Data table APPROVALS|id:s,action:s,amount:f|3|S1|W2|C0 APR001|Transfer|10000.00 APR002|Mint|5000.00 APR003|Burn|2500.00 # Signature table - one sig per row per signer SIG_APPROVALS|row:i,signer:s,signature:s,timestamp:T|6|S0|W0|C0 1|0xAlice...1111|0xSigAlice1...|2025-01-03T10:00:00Z 1|0xBob...2222|0xSigBob1...|2025-01-03T10:05:00Z 2|0xAlice...1111|0xSigAlice2...|2025-01-03T11:00:00Z 2|0xCarol...3333|0xSigCarol2...|2025-01-03T11:10:00Z 3|0xBob...2222|0xSigBob3...|2025-01-03T12:00:00Z 3|0xCarol...3333|0xSigCarol3...|2025-01-03T12:15:00Z
Blockchain Anchoring
Anchor DTL file hashes on-chain for immutable proof of existence.
Supported Chains
Ethereum
ETH, chain ID 1
Polygon
MATIC, chain ID 137
Arbitrum
ARB, chain ID 42161
Custom
Any EVM chain
Chain Table
# Anchor file hash on blockchain CHAIN|target:s,chain:e(ETH,POLYGON,ARB,BSC),txid:s,block:i,timestamp:T|1|S0|W0|C0 FILE|POLYGON|0xabc123...def456|45678901|2025-01-03T10:30:00Z # Verify on explorer: # https://polygonscan.com/tx/0xabc123...def456
Use Cases
🏦 DeFi - Transaction Records
@dtlv1.0^dtFN^pDeFiVault^c0^s2^w2^vaulthash @sec^blake3^0xVaultContract^0xContractSig^POLYGON # Vault transactions with multi-sig VAULT_TX|id:s,action:e(deposit,withdraw,yield,fee),asset:s,amount:f,user:s,timestamp:T|4|S2|W2|C0 VTX001|deposit|USDC|10000.00|0xUser1...|2025-01-03T10:00:00Z VTX002|deposit|USDC|5000.00|0xUser2...|2025-01-03T10:30:00Z VTX003|yield|USDC|150.00|0xVault...|2025-01-03T12:00:00Z VTX004|withdraw|USDC|5000.00|0xUser1...|2025-01-03T14:00:00Z # Position snapshots POSITIONS|user:s,asset:s,balance:f,apy:f,status:e(active,pending_withdrawal,closed)|2|S1|W1|C0 0xUser1...|USDC|5075.00|12.5|active 0xUser2...|USDC|5075.00|12.5|active
🎨 NFT - Metadata & Provenance
@dtlv1.0^dtWEB^pNFTCollection^c0^s1^w2^nfthash @sec^blake3^0xCreator^0xCreatorSig^ETH # NFT metadata NFTS|token_id:i,name:s,description:s,image:s,rarity:e(common,uncommon,rare,epic,legendary),creator:s|3|S1|W2|C0 1|Cosmic Dragon #1|A majestic dragon from the cosmos|ipfs://Qm..1|legendary|0xCreator... 2|Cosmic Dragon #2|A fierce dragon with fire breath|ipfs://Qm..2|epic|0xCreator... 3|Cosmic Dragon #3|A wise ancient dragon|ipfs://Qm..3|rare|0xCreator... # Ownership history (provenance) PROVENANCE|token_id:i,event:e(mint,transfer,sale,burn),from:s,to:s,price:f,timestamp:T|5|S1|W1|C0 1|mint|0x0|0xCreator...|0|2025-01-01T00:00:00Z 1|sale|0xCreator...|0xCollector1...|5.0|2025-01-02T10:00:00Z 2|mint|0x0|0xCreator...|0|2025-01-01T00:00:00Z 3|mint|0x0|0xCreator...|0|2025-01-01T00:00:00Z 3|transfer|0xCreator...|0xGallery...|0|2025-01-03T14:00:00Z
🏛️ DAO - Governance
@dtlv1.0^dtWEB^pDAOGov^c0^s1^w2^govhash @sec^blake3^0xDAOContract^0xDAOSig^ETH # Proposals PROPOSALS|id:s,title:s,proposer:s,status:e(draft,active,passed,rejected,executed),created:T,deadline:T|2|S1|W1|C0 PROP-001|Increase Staking Rewards|0xMember1...|active|2025-01-01T00:00:00Z|2025-01-08T00:00:00Z PROP-002|New Partnership Agreement|0xMember2...|passed|2024-12-15T00:00:00Z|2024-12-22T00:00:00Z # Votes - each vote is signed (W2) VOTES|proposal:s,voter:s,vote:e(for,against,abstain),power:i,timestamp:T|6|S1|W2|C0 PROP-001|0xMember1...|for|1000|2025-01-02T10:00:00Z PROP-001|0xMember2...|for|500|2025-01-02T11:00:00Z PROP-001|0xMember3...|against|750|2025-01-02T12:00:00Z PROP-002|0xMember1...|for|1000|2024-12-16T10:00:00Z PROP-002|0xMember2...|for|500|2024-12-16T11:00:00Z PROP-002|0xMember3...|for|750|2024-12-16T12:00:00Z
Implementation
Sign with Wallet (Python)
from dtl_parser import DTLDocument from dtl_parser.web3 import sign_document, verify_signature from eth_account import Account # Load or create document doc = DTLDocument.parse_file("transactions.dtl") # Sign with wallet private_key = "0x..." account = Account.from_key(private_key) signed_doc = sign_document( doc, signer=account.address, private_key=private_key, chain="ETH" ) # Verify signature is_valid = verify_signature(signed_doc) print(f"Signature valid: {is_valid}")
Anchor on Chain (TypeScript)
import { parse } from 'dtl-parser'; import { ethers } from 'ethers'; import { anchorOnChain, getFileHash } from 'dtl-parser/web3'; // Parse document const doc = parse(dtlContent); // Get file hash const fileHash = getFileHash(doc, 'blake3'); // Anchor on Polygon const provider = new ethers.JsonRpcProvider(POLYGON_RPC); const wallet = new ethers.Wallet(PRIVATE_KEY, provider); const tx = await anchorOnChain({ hash: fileHash, wallet, chain: 'POLYGON' }); console.log(`Anchored: ${tx.hash}`);
Complete SDK Integration Examples
🐍 Python - Full Web3 DTL Workflow
from dtl_parser import DTLParser, create_table, create_document import hashlib from nacl.signing import SigningKey import base64 # Create a Web3-enabled DTL document doc = create_document(domain="dtFN", profile="DeFi") doc.web3 = "w1" # File-level signing doc.security = "s1" # Row hashing # Create DeFi transaction table vault = create_table("VAULT_TXS", { "tx_id": "u", "wallet": "s", "action": "e(deposit,withdraw,claim,compound)", "token": "e(ETH,USDC,USDT,DAI,WBTC)", "amount": "f", "timestamp": "T", }, security="S1", web3="W1") # Add transactions vault.add_row({ "tx_id": "550e8400-e29b-41d4-a716-446655440000", "wallet": "0x742d35Cc6634C0532925a3b844Bc9e7595f8fE", "action": "deposit", "token": "USDC", "amount": 10000.00, "timestamp": "2025-01-15T10:30:00Z", }) doc.tables.append(vault) # Generate file hash for signing dtl_content = doc.to_dtl() file_hash = hashlib.blake2b(dtl_content.encode(), digest_size=32).hexdigest() # Sign with Ed25519 signing_key = SigningKey.generate() signature = signing_key.sign(bytes.fromhex(file_hash)) doc.hash_algo = "blake2b" doc.wallet = "0x742d..." doc.signature = base64.b64encode(signature.signature).decode() doc.chain_id = "137" # Polygon print(doc.to_dtl())
📘 TypeScript - NFT Metadata with Web3
import { parse, createTable, validate, documentToDtl } from 'dtl-parser'; import { blake3 } from '@noble/hashes/blake3'; import { ed25519 } from '@noble/curves/ed25519'; // Create NFT metadata table const nfts = createTable('NFT_COLLECTION', { token_id: 'i', name: 's', rarity: 'e(common,uncommon,rare,epic,legendary)', traits: 'j', owner: 's', minted: 'T', }, 'S1', 'W2'); // Row-level signing // Add NFTs nfts.rows.push({ token_id: 1001, name: 'Cosmic Dragon #1001', rarity: 'legendary', traits: JSON.stringify({ background: 'nebula', element: 'fire' }), owner: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fE', minted: new Date().toISOString(), }); // Validate enum values const errors = validate({ tables: [nfts], version: '1.0' } as any); if (errors.length === 0) { console.log('✅ All NFT metadata valid!'); } // Generate DTL output const dtlOutput = tableToDtl(nfts); // Hash each row for on-chain verification nfts.rows.forEach((row, idx) => { const rowStr = Object.values(row).join('|'); const rowHash = blake3(rowStr); console.log(`Row ${idx} hash: ${Buffer.from(rowHash).toString('hex')}`); });
💜 C# - DAO Governance with Web3
using Dtlaz.Parser; using System.Security.Cryptography; // Create DAO voting table var proposals = DtlFactory.CreateTable("DAO_PROPOSALS", new Dictionary<string, string> { { "proposal_id", "u" }, { "title", "s" }, { "status", "e(draft,active,passed,rejected,executed)" }, { "votes_for", "i" }, { "votes_against", "i" }, { "deadline", "T" }, }, "S2", "W1"); // Encrypted + Signed // Add proposal proposals.AddRow(new Dictionary<string, object?> { { "proposal_id", Guid.NewGuid().ToString() }, { "title", "Treasury Allocation Q1 2025" }, { "status", "active" }, { "votes_for", 1500 }, { "votes_against", 350 }, { "deadline", DateTime.UtcNow.AddDays(7).ToString("o") }, }); // Validate var doc = DtlFactory.CreateDocument("dtFN", "DAO"); doc.Tables.Add(proposals); var errors = doc.Validate(); if (!errors.Any()) { // Generate hash for blockchain anchoring var dtlContent = doc.ToDtl(); using var sha = SHA256.Create(); var hash = sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(dtlContent)); Console.WriteLine($"Document hash: {Convert.ToHexString(hash)}"); }