"Why do I have to transfer my crypto to a CEX account before I can get fiat and pay for something?" This was my thought three years ago. Even though this process doesn't take much time, I still find it inconvenient.
As an entry-level blockchain frontend engineer, this problem occupied my mind like a lioness guarding her territory. I spoke to my friend about it, and he said, "Ileolami, I have thought about this problem too." We discussed how we could provide a solution, but we had limited resources and capacity.
Then I attended a Stellar Developer meetup in Lagos in July. "Yes, this is it. This is what I need for my projects," I thought. I immediately called my friend, "Chuks, I found the solution to the problem we talked about three years ago." My excitement was palpable to the person sitting next to me at the meetup.
Are you surprised and curious? You should be. You are reading this article because I am excited to share what Stellar Blockchain is and how it solves this challenge. In this article, I will share the EIGHT THINGS YOU NEED TO KNOW BEFORE BUILDING ON STELLAR BLOCKCHAIN, along with practical examples and projects that can be built on it.
What if I told you there is a blockchain that allows interaction with traditional financial applications and seamless cross-border payments? Imagine a network where you can send or deposit cryptocurrency and receive its equivalent in fiat currencies, like US dollars or Nigerian Naira, and vice versa.
Yes, there is one, and it is STELLAR. Stellar is a layer-one, decentralized, open-source, public, and peer-to-peer blockchain. It allows developers to build applications, issue assets, and connect to existing traditional (web2) financial institutions. It is designed to enable creators, innovators, and developers to build projects on the network that can interoperate with each other.
In simple terms, Stellar is a bridge that connects the real world and blockchain technology without any noticeable differences.
The Stellar network offers fast, efficient, scalable, and affordable transactions. It is designed to handle thousands of transactions within 5 seconds, ensuring users experience minimal delays. Its efficiency is further highlighted by low transaction fees, making it an attractive option for both individuals and businesses.
The scalability of Stellar is one of its standout features, allowing it to process up to 1,000 operations per ledger. This means that the network can handle a significant number of transactions simultaneously, ensuring that users experience smooth and uninterrupted service.
Also, the affordability of transactions on the Stellar network makes it accessible to users from various economic backgrounds, promoting financial inclusion and enabling seamless cross-border payments.
Having explained what the Stellar blockchain is. In this section, you will learn about nine important aspects of Stellar: Network, Stellar Consensus Protocol, Stellar Core, Smart Contracts, RPC and Horizon, Stellar SDK, Anchors, Stellar Decentralized Exchange (DeX), and Transaction Process and Fees.
Let's dive right in.
Stellar blockchain has three networks, they are Mainnet (public network), Testnet (test network) and Futurenet (dev network). These three networks are created to help developers in various stages of development and testing.
This is the main Stellar network where real transactions take place, involving actual money and assets. It’s used when your application is live and interacting with real-world financial systems and requires Lumens (XLM) for transactions, covering fees, balances, and rent.
For example, If you were to launch a wallet app on Stellar that people use to send and receive money, Mainnet is where these transactions would happen.
This is a playground for developers to test their applications in an environment that closely mimics the Mainnet but without real money involved. It’s a safe space to experiment without financial risk.
For example, before you launch the wallet app on Mainnet, you test it first on Testnet to make sure everything works perfectly before deploying it to Mainnet.
This network can be called "Laboratory(experimental)" where developers can try out cutting-edge features that haven’t yet been rolled out to Mainnet or Testnet. It’s less stable but offers a sneak peek at future updates.
For example, If Stellar is working on a new feature that your app might use, you could test it on Futurenet before it’s officially released.
The Futurenet also works similarly to Testnet, handling the same number of operations and smart contract transactions per ledger. It is reset periodically and run by the SDF.
It is important to note that when this reset is carried out, all the test accounts and transactions you created will be wiped out. To avoid this when testing, it's recommended to carry out Test data automation that can automatically refill these networks with the necessary data after they are reset.
Stellar Consensus Protocol (SCP) is based on an infrastructure called the FEDERATED BYZANTINE AGREEMENT (FBA) using the Proof of Agreement (PoH) consensus mechanism is different from the common ones like Proof Of Work (PoW) by Bitcoin, Proof of Stake (PoS) or Proof of History (PoH).
Instead of using computational power or staked coins, SCP relies on the agreement of trusted nodes that is nodes trusting specific other nodes (called a quorum set) to agree on transactions.
To have a better understanding of how SCP works, let's use this analogy below:
Imagine participating in a quiz where the host asks each row to choose a representative to answer questions on their behalf. Your row chooses you to represent them. Every question you answer isn’t just for you; it’s for everyone in your row. With each correct answer, you feel the collective excitement build. And finally, when the quiz ends, you’ve won. But it’s not just your victory—it’s a win for your entire row.
Quorum Set
In that quiz, each row had to choose a representative to answer questions. These chosen reps represent the "quorum set" in SCP. Just like your row trusted you to answer on their behalf, in SCP, each node in the network selects a group of other nodes (its quorum set) that it trusts to help decide which transactions should be added to the ledger.
Thresholds and Quorum Slices
Let’s say in the quiz, your row decided that they needed the agreement of at least two reps to finalize your answers or theirs. This is like the "threshold" in SCP, where a node requires a certain number of trusted nodes (quorum slice) e.g. two or five nodes to agree before it accepts a transaction. If two or more reps (trusted nodes) agree with you, your answer (decision) is accepted.
Federated Voting
When you answered a question in the quiz, your partners also gave their answers. If enough of them agree with you, your answer is accepted. This process mirrors "federated voting" in SCP, where nodes vote on whether to accept a transaction based on the agreement within their quorum set.
Node Blocking Sets
Imagine if two reps from different rows consistently disagreed with your answers. They could block your answers from being accepted if they were influential enough. This is similar to "node blocking sets" in SCP, where certain nodes can prevent consensus if they disagree.
Final Consensus (Winning the Quiz)
In the quiz, because you answered most questions correctly and other reps agreed with your answers, your row won. This is like reaching the final consensus in SCP. When enough nodes (like the reps) agree on the same transaction, it’s confirmed and added to the ledger, similar to how your correct answers led to your row winning the quiz.
Stellar Core is the software that powers individual nodes in the Stellar network. These nodes maintain the distributed ledger and participate in the Stellar Consensus Protocol to validate and process transactions, typically reaching consensus and updating the ledger every 5-7 seconds.
For a better understanding, see Stellar Core as the "Class Captain" who coordinates the class. Each Student in the class represents a node. The Class Captains (Stellar Core nodes) ensure that all students (nodes) follow the same rules and agree on answers (transactions) every few seconds. After a quick discussion (reaching a consensus), the captains update the class board (ledger) with the latest correct answers.
Applications on the Stellar Blockchain are created using smart contracts. These are self-executing programmable codes designed to automatically enforce agreements and are trustless. These smart contracts are written in the Rust programming language and compiled into WebAssembly (Wasm) for deployment.
Aside from writing smart contracts in Rust, Stellar has a smart contract platform called Soroban. This means that Soroban is a designated system that provides the tools and environment on Stellar for developers to write smart contracts. This makes it possible to create decentralized applications (dApps) and complex financial services directly on the Stellar blockchain.
Note: Stellar smart contracts use few subsets of full Rust language and must adhere to the specialized libraries.
You will understand this process using an example.
Imagine you are building an Escrow feature for your E-commerce DApp. Here is the process you will follow:
First, you'll use the Soroban Rust SDK to write the smart contract for your escrow feature. The SDK provides you with tools and functions specifically designed for Stellar smart contracts, making it easier to handle tasks like cryptographic hashing, signature verification, and managing on-chain data.
Example: You code the escrow logic in Rust, ensuring that funds from a buyer are held securely until the seller fulfils their part of the transaction. This smart contract will only release the funds to the seller once the buyer confirms receiving the goods.
Example: The WASM file is like the final, packaged version of your escrow contract, ready to be installed on the blockchain.
Once the WASM file is deployed, you can create multiple instances of the escrow contract. Each instance operates independently but uses the same underlying code. For example, each buyer-seller pair in your E-commerce DApp might use a separate instance of the escrow contract.
Example: If five different buyers use your platform to buy from five different sellers, the same escrow contract can be instantiated five times—each handling a separate transaction.
Stellar also keep data querying in mind when building this blockchain. It provides four tools for developers to query network data, submit transactions, and interact with smart contracts without needing to understand the low-level details of Stellar Core, facilitating seamless communications between end-users, apps and Stellar Core.
These four tools are:
The RPC (Remote Procedure Call) service on the Stellar network provides real-time access to the current state of the blockchain within a seven-day retention window. It includes data like account balances and smart contract states.
Key features:
Soroban-RPC is a specialized version of RPC tailored for Soroban. It provides similar features but is optimized for developers working with Soroban smart contracts. Like the standard RPC, Soroban-RPC focuses on providing current state data, which is ideal for dApps that require the latest information.
Soroban-RPC is designed to be easy to deploy and maintain. Developers can quickly set up an instance using a Docker image, making it accessible without needing extensive infrastructure management.
Some of the RPC application examples are:
Data indexers are specialized tools designed to process and organize blockchain data, making it more accessible and easier to query for end users. They transform raw blockchain data into a readable structured format, enabling advanced analysis and more user-friendly interactions with the data.
It offers features such as
Advanced Querying: Data indexers allow developers to perform complex queries and retrieve specific information from the blockchain, such as filtering transactions based on certain criteria or tracking particular assets.
Enhanced Analytics: They provide features like statistical analysis, visualization of transaction flows, and tracking metrics related to decentralized finance (DeFi).
User-Friendly Interface: By making data more accessible and easier to interpret, data indexers are a more user-friendly and cost-effective choice for users who need to interact with blockchain data beyond basic transaction lookups.
This tool is suitable for apps like Crypto Wallet where your users can have better insights into their transaction history. Instead of just showing a list of transactions, using this data indexer to provide detailed analytics with Charts like Recharts Package, such as spending trends, visualization of how their assets are distributed across different accounts, or even predictive analytics to help them manage their portfolio more effectively.
Horizon is an HTTP API that acts as a bridge between applications and the Stellar network, making it easier for projects like wallets, decentralized exchanges, and asset issuers to interact with Stellar. It allows users to submit transactions, query account balances, and stream events related to accounts. This API simplifies the process by translating the complex, performance-oriented data of Stellar Core into a more user-friendly format.
Horizon can be accessed via cURL, a browser, or Stellar SDKs. Using SDKs is recommended to reduce complexity when integrating with Stellar. While you can run your own Horizon instance for full operational control, you can also use the publicly available instances provided by the SDF for the testnet and futurenet.
Horizon manages three types of data—current state, historical state, and derived state—in a single database. This setup allows for real-time transactional use but makes Horizon resource-intensive to operate.
It's important to note that Horizon does not store smart contract data but does interact with Stellar Asset Contracts (SAC) and smart contract operations like
invokeHostFunction
.
Horizon is suitable for applications like:
Hubble is an open-source, publicly accessible dataset that provides a comprehensive historical record of the Stellar network. Unlike Horizon, which is geared towards real-time transaction processing, Hubble is optimized for handling large-scale, analytic workloads. In a simple term, See Hubble as a "Lable" that can be used to shove all the records from the Stellar pot(network) onto a plate.
This tool is used when you want to handle complex queries that might cause performance issues or timeouts in Horizon. For example, if you need to analyze transaction patterns over several years or perform cross-chain analytics, Hubble is the right tool.
Also If your project requires access to the entire history of the Stellar network, such as tracking asset movement or analyzing network growth over time, Hubble provides the necessary data without the limitations of Horizon’s storage and real-time processing.
Use case includes:
Stellar’s Software Development Kits (SDKs) provide devs with the tools, libraries, and documentation to interact with and develop on the blockchain.
The SDK Library allows developers to interact with the Stellar network using various programming languages.
Here are the following programming language SDKs available:
Anchors are important components of the Stellar network, acting as on and off-ramps connecting traditional financial systems and blockchain technology. Anchors allow users to transfer fiat currencies such as the US dollars or Nigerian naira, and receive an equivalent digital token on the Stellar network. Anchors also provide digital token redemption for real-world assets.
Stellar hosts a global network of anchors, and businesses can use the Anchor Platform to create their anchor services. The Anchor platform consists of tools and APIs to easily create on-off-ramp services, using standard interfaces and stellar ecosystem offerings (SEPs) with stellar wallets and exchanges The easy-to-integrate platform supports asset management, connection services, and user account management, and offers flexible deployment options such as Docker and Kubernetes.
Remember when I told you earlier that I was seeking a solution for cross-border exchange like sending BTC and receiving it in USDT? This is a perfect use case for this.
You can build an entire Fintech company solely on this component alone e.g. EasySend(a fintech company) wants to offer a cross-border remittance service between the United States and Nigeria, allowing users to send money from the U.S. to recipients in Nigeria quickly and at a low cost.
How It Works:
On-Ramp (U.S. Anchor):
Cross-Border Transfer:
Off-Ramp (Nigerian Anchor):
The final thing that developers need to understand is how actions affect stellar networks.
Operations are the individual actions that modify the Stellar ledger from their account. For example, sending payments, invoking smart contracts, or changing account settings. Each operation has a threshold level (low, medium, or high) that determines the required signature weight for authorization. For example, if an account’s medium threshold is set to 5, the combined signature weight for operations needing a medium threshold must meet or exceed 5. Operations in smart contract transactions are limited to one per transaction.
Having understood that an Operation is a singular action that modifies the Stellar ledger then how are these several operations processed on the Stellar network?
Remember when you are learning about Stellar Networks, you learn that Mainnet supports up to 1,000 operations and 100 smart contract transactions per ledger while Testnet and Futurenet can only take up 100 operations and 1 smart contract transaction per ledger. This is what a Transaction does, it bundles up these several operations and smart contract transactions and processes them.
Transactions must be signed and authorized by the source account's public key, and if multiple signatures are needed (e.g., when the transaction affects more than one account), they must meet the required threshold weight.
Note: Transactions are atomic in the sense that if one operation or a smart contract transaction fails, the entire transaction fails.
Another thing to note is before submission, transactions undergo several validity checks, grouped into three categories: preconditions, operation validity, and transaction validity.
As you know every blockchain requires gas fees to process transactions using the blockchain token. As for stellar, Fees are paid in XLM and include a Resource Fee for smart contract transactions, based on resource consumption, and an Inclusion Fee, the maximum amount willing to be paid for ledger inclusion.
Smart contract transactions undergo metering to account for resource costs. Strategies for managing fees include setting a high maximum fee or using fee-bump transactions to ensure inclusion during surge pricing.
You must have experienced some "wow" when you read this article, Yes that's the whole essence of this article. This article has exposed you to core concepts and components of Stellar Blockchain such as Stellar Network, Stellar Core, Anchor, SCP, Stellar SDK, Operation and Transaction processing and fees, Data querying and Smart contract development.