Stellar requires users to explicitly opt-in to hold custom assets as a security measure. This prevents unwanted tokens from being sent to your account without your permission.
Understanding Stellar Assets
On Stellar, all assets except the native XLM are identified by:- Asset Code: A 1-12 character alphanumeric code (e.g., “USDC”, “EURC”)
- Issuer Address: The Stellar account that created and issued the asset
Prerequisites
Before enabling a token, ensure you have:- A funded Stellar account (minimum 1 XLM for base reserve)
- Your account’s secret key for signing transactions
- The asset code and issuer address of the token you want to enable
- An Adamik API key from dashboard.adamik.io
Step-by-Step Tutorial
Step 1: Prepare Your Request
To enable a token, use the/api/stellar-testnet/transaction/encode endpoint with the enable_token mode:
The
tokenId field follows the format: ASSET_CODE:ISSUER_ADDRESSStep 2: API Response
The API returns an encoded transaction ready for signing:Step 3: Sign the Transaction
For Stellar, you must sign the transaction hash (not the raw transaction):Step 4: Broadcast the Signed Transaction
Send the signed transaction back to Adamik for broadcasting:/api/stellar-testnet/transaction/broadcast endpoint to broadcast.
Step 5: Verify the Transaction
Upon successful broadcast, you’ll receive a transaction hash:Complete Code Example
Here’s a complete Node.js example for enabling a token on Stellar testnet:Common Testnet Tokens
Here are some commonly used tokens on Stellar testnet for testing:Troubleshooting
Common Errors and Solutions
Important Considerations
- Reserve Requirements: Each trustline locks 0.5 XLM as a base reserve
- Trust Limits: You can optionally set a maximum amount you’re willing to hold of an asset
- Asset Freezing: Some issuers can freeze assets - research issuers before trusting
- Removing Trustlines: You can only remove a trustline if your balance of that asset is zero
Next Steps
After enabling a token, you can:- Receive the token from other accounts
- Trade the token on Stellar DEX
- Send the token to other accounts that have also enabled it
- Set up path payments using the token