TLSNotary API Reference
TLSNotaryService Class
TheTLSNotaryService class manages attestation tokens and proof storage. It provides methods for both direct execution and wallet-confirmation flows.
Methods
requestAttestation()
Requests an attestation token for a target URL. Burns 1 DEM and returns a proxy URL.requestAttestationWithConfirmation()
Same asrequestAttestation() but allows user confirmation before broadcasting. Recommended for wallet extension apps.
createTLSNotary()
Convenience method that handles the full setup: request token → get proxy → create TLSNotary instance → initialize WASM.createTLSNotaryWithConfirmation()
Same ascreateTLSNotary() but with user confirmation. Recommended for wallet extension apps.
storeProof()
Stores an attestation proof on-chain or IPFS.storeProofWithConfirmation()
Same asstoreProof() but with user confirmation. Recommended for wallet extension apps.
calculateStorageFee()
Calculate the fee for storing a proof.Response Types
AttestationTokenResponse
StoreProofResponse
TransactionDetails (for confirmation callbacks)
Native Transaction Types
TLSNotary uses two native transaction types:tlsn_request
Requests a TLSNotary attestation. Creates an access token for the proxy.tlsn_store
Stores the proof on-chain after notarization completes.Cost Structure
Example costs:
- Small proof (1KB): 1 + 1 + 1 = 3 DEM + gas
- Medium proof (5KB): 1 + 1 + 5 = 7 DEM + gas
- Large proof (20KB): 1 + 1 + 20 = 22 DEM + gas
Error Codes
TLSNotary Class
TheTLSNotary class performs the actual WASM-based attestation. Use it after getting a proxy URL from TLSNotaryService.
attest() Signature
commit ranges and onStatus callback are passed as separate positional arguments, not as fields of the request object.
The request (AttestRequest) fields are:
attest() Response
verify()
Verify an attestation proof:Wallet Extension Integration
For production dApps, users connect via wallet extensions which handle key management. The SDK supports a 3-step flow for wallet extensions:The 3-Step Wallet Flow
- Generate Transaction: Create the unsigned transaction
- Sign & Confirm: Send to wallet extension for user approval and signing
- Broadcast: Send the signed transaction to the network
WithConfirmation methods implement this pattern:
Custom Headers
POST Requests
Commit Ranges (Selective Disclosure)
Control which parts of the request/response to include in the proof:attestQuick() method accepts an AttestOptions object where commit and onStatus are fields: