Deploy and mint a stablecoin
Step-by-step guide for creating and minting stablecoin tokens using the DALP TypeScript client.
Prerequisites
Before running these commands, you need to:
- Platform URL - Know your DALP platform URL (e.g.,
https://your-platform.example.com) - Deploy DALP - Have a running DALP instance (local or hosted)
- Sign up - Create a user account through the DALP UI with email/password
- Enable PINCODE - Set up PINCODE during onboarding. Manage it from Account → Wallet.
- Admin role - Your account must have
adminrole to grant system roles (Steps 3a and 3d)
Note: Your wallet address is available via DALP while signing up, or you can get it from Step 2. You'll need it for Steps 3a, 3d, 5, and 8.
Quick reference
| Step | What | Method |
|---|---|---|
| 1 | Initialize Client | initializeClient |
| 2 | Get user info | userMe |
| 3 | Set up roles & trusted issuer | Grant tokenManager, claimPolicyManager roles |
| 4 | Create stablecoin | tokenCreate (type: "stablecoin") |
| 5 | Grant token roles | tokenGrantRole |
| 6 | Unpause token | tokenUnpause |
| 7 | Add collateral | tokenUpdateCollateral |
| 8 | Mint tokens | tokenMint |
| 9 | Verify | tokenHolders |
Stablecoin token lifecycle flow
This diagram shows the complete stablecoin deployment and minting workflow, including the required collateral step:
Stablecoin-specific requirements:
- Trusted issuer registration – You must register as a trusted issuer for the
collateralclaim topic before adding collateral - Collateral – Add sufficient collateral via
tokenUpdateCollateralbefore minting (Step 7) - System roles – Requires
tokenManagerandclaimPolicyManager - Token roles –
supplyManagementfor minting,emergencyfor unpausing - Collateral claim – Amount must cover total supply based on configured collateral ratio
Step-by-step commands
Step 1: Initialize Client
Initialize the OpenAPI client with your platform URL and API key.
import { createDalpClient } from "@settlemint/dalp-sdk";
async function main() {
// Step 1: Create the SDK client
const dalp = createDalpClient({
url: "https://your-platform.example.com",
apiKey: "YOUR_API_KEY",
});
const pincode = "YOUR_PINCODE";
// Step 2: Get your wallet address
const me = await dalp.user.me({});
const myWallet = me.data.wallet;
if (!myWallet) {
throw new Error("No wallet found. Create a wallet first via the DALP dashboard.");
}
console.log("Wallet:", myWallet);
// Step 3: Set up system roles and trusted issuer status
// Grant yourself 'tokenManager' and 'claimPolicyManager'
// Register as a trusted issuer for the 'collateral' claim topic
// Step 4: Create stablecoin tokenClient helper implementation details
Here's what the helper does behind the scenes:
import { createDalpClient } from "@settlemint/dalp-sdk";
// Create the SDK client — replace with your actual values
const dalp = createDalpClient({
url: "https://your-platform.example.com",
apiKey: "sm_dalp_xxxxxxxxxxxxxxxx",
});
// All methods are fully typed with auto-complete
const me = await dalp.user.me({});
console.log("Wallet:", me.data.wallet);
const tokens = await dalp.token.list({ query: {} });
console.log("Tokens:", tokens.data.length);Why use the helper? It handles:
initializeClient(baseUrl, apiKey)– One-time setup for API authenticationtoBigDecimal()/fromBigDecimal()– Precise numeric value helpers- SDK function re-exports – All API endpoints as direct imports
Tip: Copy the client.ts file from src/examples/client.ts to your project to use the helper!
Step 2: check you're logged in
body: {
type: "stablecoin",
name: "Test USD Coin",
symbol: "TUSD",
decimals: 18,
countryCode: "840",
priceCurrency: "USD",
basePrice: "1.00",Save your wallet address - you'll need it!
Step 3: set up system roles and trusted issuer status
REQUIRED: Complete these steps to grant yourself the necessary system roles and register as a trusted issuer for collateral.
-
Grant system roles:
tokenManager- Required to create tokensclaimPolicyManager- Required to register as a trusted issuer
-
Register as trusted issuer:
- Register your identity for the
collateralclaim topic
- Register your identity for the
Note: Only users with admin role can grant system roles. If you don't have admin access, ask your system administrator to grant you these roles and register you as a trusted issuer.
Step 4: create a stablecoin token
if ("transactionId" in stablecoin) {
console.log("Stablecoin creation queued:", stablecoin.transactionId);
return;
}
const tokenAddress = stablecoin.data.id;
console.log("Stablecoin created:", tokenAddress);
// Step 5: Grant token roles
await dalp.token.grantRole({
params: { tokenAddress },
body: {
accounts: [myWallet],
role: "supplyManagement",
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},Parameters:
type: Must be"stablecoin"name: Token name (e.g., "Test USD Coin")symbol: Token symbol (e.g., "TUSD")decimals: Usually6for stablecoins (like USDC) or18countryCode: ISO country code (840 = USA, 056 = Belgium, 276 = Germany)priceCurrency: ISO currency code for liability tracking (e.g., "USD", "EUR", "GBP")basePrice: Token peg value usingfrom(value, precision)helper- Example:
from("1.00", 2)= $1.00 with 2 decimal precision - Used with
priceCurrencyfor liability tracking dashboards
- Example:
initialModulePairs: Compliance modules (empty array[]for basic setup)
Expected: Returns token data with id (contract address)
SAVE THE CONTRACT ADDRESS from the response! You need it for Step 5.
Step 5: grant token roles
REQUIRED: Grant yourself supplyManagement (for minting) and emergency (for unpausing) roles on the stablecoin contract.
},
});
console.log("Roles granted");
// Step 6: Unpause the stablecoin
await dalp.token.unpause({
params: { tokenAddress },
body: {
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},Step 6: unpause the token
console.log("Stablecoin unpaused");
// Step 7: Add collateral (Required for stablecoins)
const expiryDate = new Date();
expiryDate.setFullYear(expiryDate.getFullYear() + 1);
await dalp.token.updateCollateral({
params: { tokenAddress },
body: {
amount: 1_000_000_000_000_000_000_000_000n,
expiryTimestamp: expiryDate.toISOString(),
walletVerification: {Step 7: add collateral (required for stablecoins)
IMPORTANT: Stablecoins require collateral before minting. You must complete Step 3 first to register as a trusted issuer for the collateral claim topic.
verificationType: "PINCODE",
},
},
});
console.log("Collateral added");
// Step 8: Mint stablecoins — 1000 TUSD
await dalp.token.mint({
params: { tokenAddress },
body: {
recipients: [myWallet],
amounts: [1_000_000_000_000_000_000_000n],
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},Parameters:
amount: Collateral amount in smallest unit (e.g.,1000000000000n= 1,000,000 tokens with 6 decimals)expiryTimestamp: Future date when collateral expires
Expected: Returns token data with updated collateral
Note: If you get an error about not being a trusted issuer, register as a trusted issuer for the collateral claim topic (see Step 3).
Step 8: mint stablecoins
console.log("Minted stablecoins");
// Step 9: Verify holders
const holders = await dalp.token.holders({ params: { tokenAddress } });
console.log("Holders:", holders.data.token?.balances);
}
await main();Parameters:
contract: Your stablecoin contract addressrecipients: Array with recipient wallet address(es)amounts: Array with amounts in smallest unit- To mint X tokens with 6 decimals, use:
X * 10^6 - Example:
1 * 10^6= 1 TUSD - Example:
1000 * 10^6= 1000 TUSD - For 18 decimals:
X * 10^18(e.g.,1 * 10^18= 1 token)
- To mint X tokens with 6 decimals, use:
Expected: Returns token data with updated totalSupply
Step 9: verify the mint
Expected: Shows token holders with their balances
Full script
Complete working script - Replace the variables at the top (YOUR_PLATFORM_URL, YOUR_API_KEY, YOUR_PINCODE) and run:
Important:
- Step 3 requires granting system roles and registering as a trusted issuer
- Step 3 in the script is a placeholder comment—you must complete the role setup steps manually before continuing
- It assumes you have
adminrole to grant system roles. If you don't have admin access, you'll need your system administrator to grant you thetokenManagerandclaimPolicyManagerroles, and register you as a trusted issuer for collateral
import { createDalpClient } from "@settlemint/dalp-sdk";
async function main() {
// Step 1: Create the SDK client
const dalp = createDalpClient({
url: "https://your-platform.example.com",
apiKey: "YOUR_API_KEY",
});
const pincode = "YOUR_PINCODE";
// Step 2: Get your wallet address
const me = await dalp.user.me({});
const myWallet = me.data.wallet;
if (!myWallet) {
throw new Error("No wallet found. Create a wallet first via the DALP dashboard.");
}
console.log("Wallet:", myWallet);
// Step 3: Set up system roles and trusted issuer status
// Grant yourself 'tokenManager' and 'claimPolicyManager'
// Register as a trusted issuer for the 'collateral' claim topic
// Step 4: Create stablecoin token
const stablecoin = await dalp.token.create({
body: {
type: "stablecoin",
name: "Test USD Coin",
symbol: "TUSD",
decimals: 18,
countryCode: "840",
priceCurrency: "USD",
basePrice: "1.00",
initialModulePairs: [],
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},
});
if ("transactionId" in stablecoin) {
console.log("Stablecoin creation queued:", stablecoin.transactionId);
return;
}
const tokenAddress = stablecoin.data.id;
console.log("Stablecoin created:", tokenAddress);
// Step 5: Grant token roles
await dalp.token.grantRole({
params: { tokenAddress },
body: {
accounts: [myWallet],
role: "supplyManagement",
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},
});
await dalp.token.grantRole({
params: { tokenAddress },
body: {
accounts: [myWallet],
role: "emergency",
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},
});
console.log("Roles granted");
// Step 6: Unpause the stablecoin
await dalp.token.unpause({
params: { tokenAddress },
body: {
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},
});
console.log("Stablecoin unpaused");
// Step 7: Add collateral (Required for stablecoins)
const expiryDate = new Date();
expiryDate.setFullYear(expiryDate.getFullYear() + 1);
await dalp.token.updateCollateral({
params: { tokenAddress },
body: {
amount: 1_000_000_000_000_000_000_000_000n,
expiryTimestamp: expiryDate.toISOString(),
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},
});
console.log("Collateral added");
// Step 8: Mint stablecoins — 1000 TUSD
await dalp.token.mint({
params: { tokenAddress },
body: {
recipients: [myWallet],
amounts: [1_000_000_000_000_000_000_000n],
walletVerification: {
secretVerificationCode: pincode,
verificationType: "PINCODE",
},
},
});
console.log("Minted stablecoins");
// Step 9: Verify holders
const holders = await dalp.token.holders({ params: { tokenAddress } });
console.log("Holders:", holders.data.token?.balances);
}
await main();Common country codes
- 840 = USA
- 056 = Belgium
- 276 = Germany
- 826 = UK
- 392 = Japan
Amount calculations
For stablecoins with 6 decimals (like USDC), use the formula: amount * 10^6
Examples:
- 1 TUSD =
1 * 10^6=1000000 - 10 TUSD =
10 * 10^6=10000000 - 100 TUSD =
100 * 10^6=100000000 - 1000 TUSD =
1000 * 10^6=1000000000
For tokens with 18 decimals, use the formula: amount * 10^18
Examples:
- 1 token =
1 * 10^18=1000000000000000000 - 10 tokens =
10 * 10^18=10000000000000000000
To mint X tokens, calculate: X * 10^decimals (where decimals = 6 for stablecoins like USDC, or 18 for other tokens)

Troubleshooting
"Authentication missing" → Check your API key in initializeClient.
"PINCODE_INVALID" → Reconfirm the PIN from Account → Wallet (/account/wallet)
"USER_NOT_AUTHORIZED" / "tokenManager required" → Grant the tokenManager role (requires admin access)
"Permission denied" → Grant the required token roles (supplyManagement, emergency)
"Token is paused" → Make sure Step 6 (unpause) succeeded and you have emergency role
"InsufficientCollateral" → Make sure Step 7 (add collateral) succeeded. You must be a trusted issuer for the collateral claim topic.
"You are not a trusted issuer for topic(s): collateral" → Register as a trusted issuer for the collateral claim topic (see Step 3)
"RecipientNotVerified" → Your wallet needs an identity registered before it can receive tokens. Register using systemIdentityCreate.
Need jq? Install with: brew install jq (Mac) or apt install jq (Linux)
Deploy and mint a fund
Step-by-step guide for creating and minting fund tokens using the DALP TypeScript client.
Configure equity collateral
Configure collateral backing requirements for equity tokens via the Collateral Compliance Module API, enforcing minimum reserve ratios before minting shares. The module validates that the token's identity holds sufficient collateral claims before allowing new tokens to be minted.