How to Issue Assets on Stellar Blockchain

issue assets on stellar blockchain

Ever thought about turning your assets into digital tokens? Stellar makes it a breeze! Whether you’re a big bank, a local community group, or just someone curious about the tech world, this platform’s got your back. Stellar not only allows you to tokenize, but you can also trade and transfer them with ease across its vast network.

And here’s the cherry on top: you can customize these tokens for specific scenarios using Stellar’s built-in tools. Need to get them listed on an exchange? No worries! Stellar has its decentralized exchange, and if liquidity is what you’re after, you can employ some nifty market-making bots to tap into Stellar’s worldwide audience.

Now, a lot of folks are using Stellar to turn regular currencies into tokens, especially to make international transactions smoother. But, before we dive into the ‘how-tos’, let’s chat about what makes up these digital assets.

Contents

Anatomy of an Asset

Anatomy of an Asset

If you’re diving into the world of Stellar assets, there are a couple of key things you’ll want to understand. Let me break them down for you:

What’s in a Name? (Or rather, a Code!)

Every Stellar asset comes with its very own Asset Code. Think of it as the unique name tag for your asset.

Now, when you’re setting this code, you’ve got two choices: either keep it short with up to 4 characters, or go a bit longer with up to 12 characters. Regardless of its length, this code is super important because it gives people a quick idea of what your asset’s all about.

Meet the Issuer (The Asset’s Guardian)

Alright, now let’s talk about The Issuer. When you create an asset on Stellar, it’s like making a payment. And the account that does this payment? Yep, that’s the issuer. They’re the ones who bring the asset to life on the network.

Now, with great power comes great responsibility! The issuer is the one who has the reins of the asset and ensures everything’s running smoothly.

Unique ID for Every Asset

Here’s a fun fact: Sometimes, asset codes can be a little… similar. More than one group might issue a token that represents the same thing. But don’t worry! By pairing the issuer with the asset code, every single asset gets its own unique identifier.

And what’s cool about these tokens? They’re super versatile. They can stand in for a whole bunch of things outside the network – think of gold bars, paper money, even carbon credits. 

Just a quick heads-up: if you’re thinking of issuing a regular currency, stick with the standard ISO 4217 code. And for bonds or stocks? Use the right ISIN number.

Understanding Trustlines: It’s All About Trust!

Ever heard of Trustlines? Well, think of them like your trusty sidekicks in the Stellar ledger universe. Created via a change_trust operation, they are essentially ledger entries that hang around at the account level.

Now, before an account can cozy up with an asset created by another account, it needs to set up one of these trustlines. This trustline has a twofold purpose:

  • Firstly, it helps identify both the issuer and what the asset’s called.
  • Secondly, it plays multiple roles:
    • Boosts an account’s minimum lumen balance by one base reserve (right now, that’s 0.5XLM).
    • Keeps a tab on how much of the asset is held by an account.
    • Monitors the assets’ obligations.
    • Makes sure there’s enough balance for sales and enough wiggle room below its limit for purchases.

Let’s Talk Numbers: Precision Matters!

Ever wondered how assets keep their precision in the Stellar world? It’s all down to the Amount Precision. These asset amounts get encoded into 64-bit integers inside these structures called XDR. Stellar’s quite fond of using them for transaction encoding.

The actual secret sauce here? Take the asset amount (the one users see) and shrink it down by a whopping ten million. All these values stay comfy as int64s to dodge those pesky bugs which can pop up when you mix and match signed and unsigned integers.

Keeping it Real with Horizon and Client Libraries

So, when you’re playing around in the Horizon or Stellar client libraries (like js-stellar-sdk), all this integer-encoded value stuff gets swept under the rug. Some languages, like our buddy JavaScript, can get a bit finicky holding onto the precision of big numbers. 

Most APIs love seeing the amount in its full-blown value. That’s why it’s a smart move to rely on a “big number” library. It’ll hold onto those massive decimal numbers without letting any details slip through the cracks.

Meet Lumens (XLM)

Meet Lumens

Think of Lumens as the beating heart of the Stellar network. Unlike other assets on Stellar, Lumens doesn’t need a trustline or an issuer. Cool, right? 

Plus, when you’re doing any transaction on Stellar, you’re going to be paying fees using Lumens. That’s why it’s key for every account to have a bit of Lumens stashed away. Oh, and fun fact: Lumens can get really tiny. 

The tiniest fraction of a Lumen is called a “Stroop”, which is just one ten-millionth of a single Lumen.

Let’s Talk Representation

On the Horizon front, assets show up as a simple JSON object. Here’s an example:

json

{

  “asset_code”: “AstroDollar”,

  “asset_issuer”: “GC2BKLYOOYPDEFJKLKY6FNNRQMGFLVHJKQRGNSSRRGSMPGF32LHCQVGF”,

  “asset_type”: “credit_alphanum12”

}

While over at Stellar SDKs, they take the form of the Asset class. Like this:

javascript

var astroDollar = new StellarSdk.Asset(

  “AstroDollar”,

  “GC2BKLYOOYPDEFJKLKY6FNNRQMGFLVHJKQRGNSSRRGSMPGF32LHCQVGF”

);

Bringing Assets to Life

Creating assets on Stellar? It’s a bit different. Instead of a single, standalone operation, it’s a journey through a few steps using payment operations. Imagine you’re issuing an asset – the moment you make a payment with that asset, bam, it’s alive on the network! Here’s a quick breakdown:

  • Fire up an issuing account.
  • Get a distribution account ready.
  • Set up that trustline.
  • Make your payment.

A quick heads-up: You’re not tied to issuing assets to a specific distribution account, but it’s good practice to send them to an account with the right trustline. And remember, if you’re keen on minting a token on the public network, you’ll need an account with some Lumens in it to kickstart the whole creation, issuing, and distribution process.

How to Issue an Asset on Stellar Blockchain

Eager to dive into the Stellar universe and issue your own asset? You’re in for a treat. With Stellar, token issuance isn’t wrapped up in intricate processes. In fact, it’s as straightforward as making a payment. 

A unique twist, isn’t it? Stellar favors the payment operation method, sidestepping the traditional complexities.

However, while Stellar simplifies the process, navigating the blockchain world can still be a bit daunting. That’s where Webisoft steps in. 

We’re your trusty guide in this adventure, ensuring that your journey to issue assets on the Stellar blockchain is smooth, efficient, and rewarding.

 Now, let’s get into the specifics and break it down.

How to Issue an Asset on Stellar Blockchain

Step 1: Create the Issuing and Distribution Accounts

Before diving deep into the stellar API documentation or exploring the stellar token list, let’s simplify the first big step: creating your issuing and distribution accounts. Here’s why and how.

The Issuing Account: Where It All Begins

Think of this as the birthplace of your asset. Once linked, it’s bound to your asset’s identity eternally.

The Distribution Account: Your Asset’s First Stop

This is where your asset first lands, like a depot for your tokens before they embark on their journey.

Creating an Account: A Two-Step Dance

  • Whip up a keypair.
  • Bring that account to life using the create_account operation.
  • Now, even if you’ve got your keypair (which, by the way, won’t cost you a dime), your account is like a ghost on the Stellar ledger until it’s infused with enough XLM to cover its minimum balance.

A Few Handy Tips

  • Testing waters on testnet? Grab some free XLM from Friendbot.
  • If you’re making a splash in production, you’ll need some live XLM. An existing account can toss you enough to cover those pesky transaction fees, a trustline, and that all-important minimum balance.
  • Skating close to the minimum balance is dicey. You might end up short on XLM for your needs.

Why Two Accounts? Isn’t One Enough?

Well, separating your issuing and distribution accounts is about safeguarding your stellar asset issues and smart bookkeeping.

Some might argue, “Hey, why not just use one?” Sure, you could even cook up a market from the issuing account or trade and issue directly. But let’s paint a picture. The account spreading your asset around gets a lot of attention (let’s call it a ‘hot’ account). Some online platforms might even get signing rights for its activities.

Imagine both accounts being one. A shady character could flood the market with your asset, increasing risks and potential off-chain problems. If they cash in these tokens using anchor services, the anchor might not have the cash flow to back it up.

However, with distinct accounts, you’ve got a safety net. In fishy situations, freeze the asset balance, kickstart a fresh distribution account, and your issuing account remains untouched.

Plus, on the auditing front, it’s simpler to have a clear inventory of assets in separate accounts. And remember, an issuing account can’t hold its own asset’s balance.

Lastly, distribution accounts give innovators the freedom to brainstorm new ideas without tweaking the foundational protocols.

Step 2: Trust is Everything – Setting Up a Trustline

Imagine this as your Stellar handshake. Here, your distribution account sends out a change_trust operation, signaling Stellar that it’s ready to hold an asset. Interesting fact? The trust is built between the distribution and issuing accounts.

When the distribution account gets into action with the change_trust operation, it clearly mentions the issuer’s identity and the asset code. 

And here’s the fun part: This is when your asset code makes its first appearance on the ledger. It’s like naming your asset, and surprisingly, it’s not the issuing account but the distribution account that does the naming.

Step 3: Money Moves – Making the Payment

Once you’ve set the stage, it’s time for the issuing account to make its move, transferring the newly christened asset over to the distribution account. 

As long as everything’s smooth sailing, new tokens can pop up just by the issuing account making payments. Not just to the distribution account, but any account that has the magic trustline.

But here’s a tip: Before you take the next leap, getting the stellar.toml file in order is crucial. Why? This little file is your golden ticket to informing exchanges, digital wallet providers, potential token aficionados, and market listers about the brilliance of your asset.

Why Publicizing Asset Details Matters

Alright, you’ve issued your asset. Time to shout it from the rooftops! How? By connecting a home domain to your issuing account and placing a meticulously detailed stellar.toml file right on it. 

This is your chance to fill in everyone – from potential purchasers to exchanges and digital wallet services. Some perks of getting this right include:

  1. Earning trust from potential investors.
  2. Boosting your asset’s visibility.
  3. Bagging a spot on multiple exchanges.
  4. Amplifying the success odds of your project.

Did you know? Entities such as the Stellar ticker (a treasure trove of market data), trading platforms like Stellarport and StellarX, and even wallets such as Lobstr and Solar rely heavily on stellar.toml files.

This nifty file, crafted in TOML (a language that’s a treat for both machines and us humans), lays out everything about your Stellar configuration. Linking it up is simple: Host it, connect it to your Stellar account, and voilà! You’re good to go.

Now, diving into the stellar.toml file, there are four main areas you should focus on:

1. General Info

This is basic but crucial. Think of details like:

  • Associated Stellar account public keys.
  • Other relevant Stellar integration details for better discoverability.
  • Resource locations supporting other SEPs or hosting a public Horizon instance.
2. Organization Data

Here, let the world know about your entity. Some key points include:

  • Your official website.
  • Your entity’s full name.
  • Your company’s logo link.
  • The physical location of your organization.
  • The best email to reach you.

And if you’re feeling generous, sprinkle in some extra details:

  • Your Twitter and GitHub official pages.
  • A little snippet about what your company does.
  • Your Keybase official account.
3. Contact Points

Essentially, where people can get in touch. This should contain:

  • Primary contact name and email.
  • The primary person’s GitHub, Twitter, and Keybase details.
4. Currency Specifics

Dive into details about your assets:

  • Your asset’s unique code.
  • Stellar public key of the issuing account.
  • Anchor details – whether it’s native or anchored.
  • The kind of asset your token embodies.
  • The anchor’s moniker.
  • How to redeem the token for its underlying asset.
  • A clear depiction of what your token stands for.
  • Any token redemption terms.
  • A token image URL, if you have one.

Step 4: Showcasing Your stellar.toml File

Ready to share your stellar.toml with the world? Here’s how to go about it:

Uploading Your File: Head over to https://YOUR_DOMAIN/.well-known/stellar.toml. Here, swap out YOUR_DOMAIN with your actual domain – could be localhost or whatever you’ve chosen. Curious about what this file does? Take a look here.

CORS – The Bridge Between Domains: Ensure you’ve got CORS enabled, making your file reachable from various sites. Aim for the header Access-Control-Allow-Origin: * when someone requests your /.well-known/stellar.toml file.

Display, Not Download: Make sure browsers showcase the file content rather than prompting a download. Set the content type as text/plain. And to tie it back to your issuing account, use the set_options operation.

Step 5: Navigating the Asset Access Waters

So, you’ve issued your asset on Stellar. The default setting? Anyone can hold it. Sounds great for liquidity, right? But wait, what if you need more control or have KYC processes to handle?

Setting the Stage with Flags

Using the set_options operation, you can add or change flags at any point in your asset’s journey. Let’s decipher these:

Do They Need a Nod from You? (Authorization Required)

When you turn this on, you decide who gets to hold your asset. Here’s the deal: a user sets up a trustline, and you then give the green light using the allow_trust operation. You’ve got two choices here:

Full Go-Ahead (AUTHORIZED)

This means they’re free to use the asset – making payments, getting payments, and even placing orders.

Limited Pass (AUTHORIZED_TO_MAINTAIN_LIABILITIES)

Here, they can keep current orders but can’t use the asset in other ways.

Take Back the Permission (Authorization Revocable)

With this on, you can retract an existing trustline’s authorization. 

This can lock the asset in someone’s account. It also lets you tone down the account’s access, making sure they only manage existing orders and nothing more. 

If you do pull the authorization, remember it also cancels their open orders. Changes? The allow_trust operation’s got you covered.

Setting Things in Stone (Authorization Immutable)

Once you turn this on, it’s a promise to potential token holders. Your account and assets will always be available on the ledger, and you can’t set other flags or merge the issuing account.

Need More Control? (Clawback Enabled)

Setting this flag gives you an upper hand. All new trustlines will have the clawback feature. You can pick and choose which trustline gets this. But note, this needs the authorization revocable flag to be active.

A Peek into the AUTHORIZED_TO_MAINTAIN_LIABILITIES Flag

Imagine you’re an issuer of a regulated asset. There’s a flag you might find interesting: the AUTHORIZED_TO_MAINTAIN_LIABILITIES. Using this, if you fancy overseeing transactions on a case-by-case basis but still let them hang onto offers, you can leave an account in this state. Neat, right?

Step by Step: How This Flow Works

Picture this: A holding account knocks on the issuer’s door, asking to sign off on a brand new transaction. Once the issuer gives it a good look and a thumbs up, it gets nestled between a couple of operations, kind of like a sandwich.

Now, let’s say Alice wants to send some cash over to Andrew. Here’s how the process would look, sandwiched in between set_trust_line_flags operations:

Step 1: The issuer flips the switch on Alice’s account for a certain asset (let’s call it asset X) to “Fully Authorized” using the SetTrustLineFlags operation.

Step 2: Andrew gets the same treatment: his account, also for asset X, is now “Fully Authorized.”

Step 3: The big moment – Alice sends the payment over to Andrew.

Step 4: Using the SetTrustLineFlags operation, the issuer adjusts Andrew’s account status for asset X to the AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG state.

Step 5: Alice’s turn again. Her account for asset X gets adjusted to the same state as Andrew’s.

What’s cool about this “authorization sandwich” is that it lets the issuer take a magnifying glass to specific payments. Only the payments they approve get the green light.

And since these steps are all wrapped up in one neat package, Alice and Andrew know they’re good to go for this specially approved operation.

Sample Code

Do you know how in cooking shows they give you a simplified version of the recipe? We’re about to do just that.

This code snippet helps you set both revocable and required authorizations. Now, we’ve kept things pretty streamlined here. 

However, always remember in a real-world scenario, you’d want to be on the lookout for potential hiccups by adding error checks.

javascript

const StellarSdk = require(“stellar-sdk”);

const server = new StellarSdk.Server(“https://horizon-testnet.stellar.org”);

// Just think of these as the keys to your digital treasure chest

const issuingKeys = StellarSdk.Keypair.fromSecret(

  “SCZANGBA5YHTNYVVV4C3U252E2B6P6F5T3U6MM63WBSBZATAQI3EBTQ4”

);

server

  .loadAccount(issuingKeys.publicKey())

  .then(function (issuer) {

    const transaction = new StellarSdk.TransactionBuilder(issuer, {

      fee: 100,

      networkPassphrase: StellarSdk.Networks.TESTNET,

    })

      .addOperation(

        StellarSdk.Operation.setOptions({

          setFlags: StellarSdk.AuthRevocableFlag | StellarSdk.AuthRequiredFlag,

        })

      )

      // This timeout? It’s like setting a timer while baking. Essential!

      .setTimeout(100)

      .build();

    transaction.sign(issuingKeys);

    return server.submitTransaction(transaction);

  })

  .then(console.log)

  .catch(function (error) {

    console.error(“Oops, something went awry!”, error);

  });

Stellar Anchors: Your Gateway to Digital Tokens

Stellar Anchors

Think of Stellar anchors as reliable gatekeepers. They take in your fiat money, navigate traditional banking routes, and hand back to you the shiny digital tokens on the Stellar network. Oh, and if you ever want to trade back? These anchors are right there to help you exchange tokens for the actual assets they represent.

Not only can Stellar anchors build their own digital assets, but they also have the expertise to recognize and work with existing ones. With an anchor by your side, you can:

  • Go Global: Make international payments effortlessly via Stellar.
  • Toggle Between Worlds: Move assets onto or away from the Stellar network.
  • Enjoy Seamless Integration: Benefit from the Stellar Ecosystem Proposals ensuring interoperability.

Speaking of integration, Stellar’s openness demands it to be nimble, welcoming new products with open arms. And, trust the Stellar Development Foundation to lead the way! They’ve set the gold standard (or should we say, ‘Stellar’ standard?) for network participants to follow.

Curious about these standards? They’re all detailed in the Stellar Ecosystem Proposals (SEPs) on GitHub, addressing a variety of cases – from dealing with regulated assets to streamlining user identification.

Implementing Stellar Protocols: SEP-24 & SEP-31

Embarking on this journey? Here’s a straightforward three-stage plan for you:

  • Start Small, Think Big: Craft your service on Stellar’s Testnet network.
  • Ready, Set, Launch: Migrate to Stellar’s Mainnet and join it with your existing offline procedures.
  • Collaborate and Conquer: Partner with existing Stellar wallets or anchors, and unveil your product to the world!
Step 1: Facilitating Global Payments via Stellar

For seamless international payments on Stellar, teamwork makes the dream work. The sending anchor (SA) and receiving anchor (RA) must join forces. 

Step 2: Smoothing Asset Movement on Stellar

Managing assets on Stellar requires a beautiful dance between the wallet (playing the client role) and the anchor (acting as the server). 

Final Thoughts

The world of Stellar is as intriguing as it is advantageous. When you’re aiming to issue assets on the Stellar blockchain, it presents an unparalleled realm of potential. Yet, it’s essential to acknowledge that such journeys, while promising, can be intricate.

Now, if you ever feel that this blockchain journey is a tad overwhelming, remember that Webisoft has been there, charted that! Our seasoned team specializes in making Stellar’s potential understandable and accessible.

Let us be your compass in this expansive universe.Considering issuing assets on the Stellar blockchain? Webisoft is here, just a call away, ready to illuminate the path for you.

Ready to turn your idea into reality?

Get in touch with our expert tech consultants to vet your idea/project in depth.

Don't get stuck with bad code. We build it right, the first time, without friction.

Let’s brainstorm on potential solutions with a precise estimate and then you decide if we’re a match.

Scroll to Top