panurus

Token API

The Token API (token/) provides a powerful and versatile abstraction for managing digital tokens across various distributed ledger backends. It decouples application logic from the underlying cryptographic and consensus mechanisms, allowing developers to build sophisticated token-based applications that are both portable and privacy-preserving.

The Token Data Model

Panurus defines a token as a discrete unit of value with a three-part structure:

Tokens are uniquely identified by a token.ID, which consists of the Transaction ID that created it and its Index within that transaction’s outputs.

Fungibility and NFTs

Token Management Service (TMS)

The ManagementService (TMS) is the primary entry point for the Token API. It orchestrates all token-related operations for a specific “space” on the ledger.

TMS Identification

A TMS is uniquely identified by a TMSID:

  1. Network: The identifier of the underlying DLT (e.g., “fabric”).
  2. Channel: The partition or channel within the network.
  3. Namespace: The specific smart contract or chaincode managing the tokens.
graph TD
    TMSP[TMS Provider] -->|GetManagementService| TMS[Management Service]
    TMS --> Vault[Vault]
    TMS --> WM[Wallet Manager]
    TMS --> PPM[Public Params Manager]
    TMS --> Selector[Selector Manager]
    TMS --> Validator[Validator]
    TMS --> Certification[Certification Manager]

Public Parameters Manager

The PublicParametersManager holds the cryptographic setup required to operate a specific token system. These parameters are often referred to as the “Trust Anchor” and include:

Wallet Manager

The WalletManager manages the digital identities used to interact with tokens. It categorizes identities into specialized roles:

Token Requests and Transactions

A Request is a ledger-agnostic blueprint for a token transaction. It bundles multiple actions into a single atomic unit.

Core Actions

The Request Lifecycle

  1. Assemble: Add actions to the Request using a TMS.
  2. Sign: Generate witnesses (signatures or ZK proofs) using the appropriate Wallets.
  3. Translate: The Network Service converts the request into a ledger-specific format (e.g., a Fabric RWSet).
  4. Commit: The transaction is submitted to the network and monitored for finality.
sequenceDiagram
    autonumber
    actor App as Application
    participant TMS as Token Management<br/>Service
    participant WM as Wallet Manager
    participant NS as Network Service
    participant Ledger as DLT Ledger

    box darkgreen Panurus Stack
        participant TMS
        participant WM
        participant NS
    end

    App->>+TMS: NewRequest()
    App->>+TMS: Transfer(Wallet, Amount, Recipient)
    TMS->>+WM: GetSigner(Identity)
    App->>+NS: Broadcast(Request)
    NS->>+Ledger: Submit Transaction
    Ledger-->>-NS: Finality Notification
    NS-->>-App: Transaction Confirmed

Token Vault and Selector

Panurus provides sophisticated tools for managing the local state of tokens:

Validator

The Validator is the guardian of the token system. It is responsible for verifying that a Token Request adheres to all system rules before it is committed to the ledger. This includes:

In privacy-preserving drivers, the Validator performs complex Zero-Knowledge proof verification to ensure transaction validity without revealing sensitive data.