Stellar Interchain Token Service (ITS)
What is the Interchain Token Service?
The Interchain Token Service (ITS) is a protocol that allows tokens to move freely between different blockchains. Think of it as a universal bridge for tokens - it provides a standardized way to:
- Create new tokens that automatically exist on multiple blockchains.
- Connect existing tokens from one blockchain to other blockchains.
- Transfer tokens securely between blockchains.
For Stellar developers, ITS opens up new possibilities to interact with tokens from Ethereum, Polygon, Avalanche, and many other blockchains without understanding the intricacies of each chain’s token standards.
How ITS Works on Stellar
Unlike on EVM chains (like Ethereum), where tokens follow the ERC-20 standard, Stellar has its native token structure. The Axelar ITS integration adapts to Stellar’s unique characteristics:
-
Hub Mode Operation: Stellar ITS works exclusively in “Hub mode” - all cross-chain messages go through the central Axelar network rather than directly between chains.
-
Token Representation: When an external token (like an Ethereum ERC-20) comes to Stellar, it’s represented by a Stellar token that’s controlled by a special contract called a
TokenManager
. -
Trust System: Instead of trusting specific addresses (as in EVM implementations), Stellar ITS uses a system of trusted chains.
With the integration of Stellar to Axelar, Stellar-based contracts can now leverage ITS to interact with tokens from other blockchain ecosystems connected to Axelar.
Key Components of ITS
Before diving into implementation, let’s understand the key components:
-
InterchainTokenService
: The main contract that coordinates token-related operations. It’s the primary interface for cross-chain token functionality. -
TokenManager
: A contract that handles tokens’ minting, burning, and locking on a specific blockchain. Each token has its ownTokenManager
. -
InterchainToken
: The token contract implementing Stellar’s token interface. -
Gateway
: Facilitates the cross-chain message passing between Stellar and other blockchains. -
GasService
: Handles payments for cross-chain transactions. Without this, messages couldn’t be relayed between chains.
What You Can Do With ITS
ITS enables several robust use cases on Stellar:
Deploy a new Interchain Token on Stellar:
fn deploy_interchain_token( env: &Env, caller: Address, salt: BytesN<32>, token_metadata: TokenMetadata, initial_supply: i128, minter: Option<Address>,) -> Result<BytesN<32>, ContractError> { // Returns a token_id that uniquely identifies your token across all chains}
Deploy an Interchain Token Remotely to Other Chains:
fn deploy_remote_token( env: &Env, caller: Address, salt: BytesN<32>, destination_chain: String, gas_token: Option<Token>,) -> Result<BytesN<32>, ContractError> { // Deploys your token to another blockchain like Ethereum, Avalanche, etc.}
Register an Existing Stellar As an Interchain Token to Make It Available on Other Chains
These functions let you link existing tokens to the ITS network, making them available across chains.
// Register an existing Stellar tokenfn register_canonical_token( env: &Env, token_address: Address,) -> Result<BytesN<32>, ContractError> { // Registers an existing token with the ITS}
// Deploy that token to other chains (Ethereum, Avalanche, etc.)fn deploy_remote_canonical_token( env: &Env, token_address: Address, destination_chain: String, spender: Address, gas_token: Option<Token>,) -> Result<BytesN<32>, ContractError> { // Makes your existing token available on other blockchains}
Transfer Tokens Cross-Chain
Send tokens between Stellar and any supported blockchain:
fn interchain_transfer( env: &Env, caller: Address, token_id: BytesN<32>, destination_chain: String, destination_address: Bytes, amount: i128, data: Option<Bytes>, gas_token: Option<Token>,) -> Result<(), ContractError> { // Transfers tokens from Stellar to another blockchain}
Trusted Chain Management
Before sending tokens cross-chain, you can check if the destination chain is valid or trusted:
fn is_trusted_chain(env: &Env, chain: String) -> bool { storage::is_trusted_chain(env, chain)}
Receive Tokens from Other Chains
To receive tokens from other blockchains, the contract must implement message handling:
fn execute( env: &Env, source_chain: String, message_id: String, source_address: String, payload: Bytes,) -> Result<(), ContractError> { // This function: // 1. Validates that the message is coming from the ITS Hub // 2. Decodes the message to determine its type // 3. Processes it appropriately - either as a token transfer or a token deployment}
Flow Limits
The ITS implementation includes a flow-limiting system to control how many tokens can move in a given period:
#[only_operator]fn set_flow_limit( env: &Env, token_id: BytesN<32>, flow_limit: Option<i128>,) -> Result<(), ContractError> {}
This function allows the operator to limit how many tokens can flow in or out over time.
Next Steps
Learn More: Explore our tutorial on building a rust project from scratch with interchain token service implementation to deploy and transfer tokens from Steller to EVM. This tutorial will guide you through distributing tokens across multiple chains.