Build a Stellar App | Stellar Blockchain App Development (2024)

Blockchain technology has gained a lot of popularity since its emergence in the market. Blockchain use cases in finance such as cryptocurrencies were the first applications of the technology. As the world globalizes and the demand for cross-border payments expands, companies will drive towards innovation in blockchain payments.

We believe that Stellar Core is one of the highly significant distributed technologies that allow anyone to develop low-cost and quick financial solutions. Our blockchain experts have worked upon a number of PoCs and discovered the possibilities with the platform.

In this article, we are going to explain why Stellar is the right platform for developing Fintech apps and how to develop Stellar blockchain apps.

  • What is Stellar?
  • Features of the Stellar blockchain network
  • Use cases of the Stellar blockchain
  • How to build a Stellar App?

Let’s start first with the basic understanding of Stellar Blockchain.

What is Stellar?

Stellar, an open-source blockchain protocol, offers users the ability to exchange money and tokens using the Stellar Consensus Protocol (SCP). Stellar is a distributed ledger network that connects individuals, banks, and payment systems. Its architecture aims to facilitate cross-asset and low-cost value transfers.

Stellar’s open-source payment technology shares some similarities with Ripple, a real-time gross settlement currency that can be used for remittances and payments. Stellar’s founders are Joyce Kim and Jed McCaleb, who co-founded Ripple. Stellar and Ripple initially shared the same protocol. However, later Stellar created the Stellar Consensus Protocol, which led to foundational differences between both platforms. Stellar became an open-source platform through the SCP, while Ripple remained a closed system.

Lumen (XLM) is the native currency of Stellar that powers its network and operations.

Stellar is a distributed network that connects interconnected servers (nodes) within the Stellar network. Anyone can create a Stellar Core verification node by using the Stellar Core, which is the backbone of the Stellar network. It is responsible for verifying transactions using the Stellar Consensus protocol. This protocol is the algorithm that verifies transactions on the Stellar network.

The Stellar Core is run by trusted nodes, known as verification nodes. They verify transactions, unlike the Bitcoin network, where miners verify transactions. The Stellar network is made up of several Stellar Cores, which work together to verify transactions.

Features of the Stellar blockchain network

Stellar Consensus Protocol (SCP), with Stellar’s application programming interface (API), Horizon, and other growing tools and products, creates an environment that allows developers and businesses to use the network’s most powerful features and build upon them. The Stellar network leverages its most compelling features like:

  • Speed:Stellar transactions are confirmed within 3-5 seconds.
  • Cost:The transaction cost, regardless of transaction size, is negligible. In 2021, it was slightly more than 0.00001 lumens ( Stellar network’s cryptocurrency). The protocol sets fees that are then burned to discourage bad actors.
  • Asset issuance:Stellar’s support code is fast, reliable, and vetted. Tokens can be issued in as little as a few lines of code.
  • Decentralized exchange:Stellar uses a common order book called the Stellar decentralized exchange. Every token can be exchangeable, and the Stellar protocol connects buyers to sellers.
  • Compliant:Stellar is a leader in compliance, with built-in features that allow unified KYC and Anti-Money Laundering (AML) processes, asset control at the protocol level, and issuer-enforced finality.
  • Stellar developer tools:Stellar’s open-source developer resources offer comprehensive documentation, SDKs, as well as tutorials.
  • Sustainable:The network is sustainable because of Stellar’s consensus mechanism. It costs the same as running a server, and resource requirements are lower than mining.
  • Stellar XLM:Stellar has created a native currency, Lumens or XLM, as a non-discriminatory way to stop spamming on its network. Everyone who uses Stellar must keep a few Stellar lumens in an account. All users have equal access to this amount. While the XLM coin requirement keeps Stellar available, it deters malicious and frivolous actors from engaging on a large scale with the Stellar network.

Use cases of the Stellar blockchain

Following are some of the use cases of the Stellar blockchain:

Tokenization for collectibles

The foundation for the modern digital economy is tokenization. This technology is used by billions every day. The tokenizing process involves exchanging valuables (including cash, stocks, bank details, and health records) for tokens that accurately reflect those assets. This makes it easier and safer to transact. Although tokenization might seem far-fetched, it is already changing lives and potentially transforming businesses. Tokenization is a persuasive way for many people to own priceless treasures.

The Stellar blockchain’s biggest use case is the tokenization of fiat currency that optimizes processes like cross-border payments and enables deposit and withdrawal.

Tokenization for securities

Security tokens are a special type of cryptocurrency used to verify and protect property rights and facilitate payment transactions for specific assets, groups of assets or a set of rights. These tokens have many of the same benefits as other digital currencies. However, they differ in the fact that they can be encoded using certain characteristics and capabilities. Crypto security tokens will change how information is transferred in capital markets as long as banks continue expanding on existing regulations.

The Stellar Development Foundation (SDF) has already invested a huge amount in Lumens (XLM) tokens in DSTOQ, a security token platform that provides access to traders to the global markets from their smartphones.

Cross-border payment and exchange

Blockchain is another way to improve the effectiveness of cross-border payment. A platform such as Stellar blockchain still allows people with limited or no access to financial services to receive cash services. These include interactions between local payment infrastructures, cross-border adoptions of shuttered enterprise apps, and a peer-to-peer, blockchain-based payment system. An XLM transaction in a Stellar network costs $0.0000006. This cost is much lower than other virtual currencies. It is, therefore, more affordable than global money transfers.

Peer-to-peer payments

Peer-to-peer (P2P) payment networks have evolved into a new way of payment. Your peer-to-peer account could replace your credit or cash cards for online purchases or local markets. With Stellar blockchain, users can instantly transfer money from one account to another.

Anchor assets

The payment world is in chaos. Each area uses its own non-interoperable method of payment. Stellar allows the representation of all world’s economies in digital assets. This platform allows them to interact and bridge these disparate payment services freely. Stellar blockchain allows these digital tokens to interact with any wallet or application that uses the Stellar platform. This will allow users to access a wide range of affordable financial products.

Access to financial services

Stellar is a new blockchain network for international transactions. It is compatible to accomplish that goal, linking the digital payment rails of the financial industry and modern digital payment systems to make it easier to source cross-border. Stellar blockchain technology is available to integrate the financial sector, regardless of where you are located. It can provide interoperability among networks and types of value. Accessibility and equality are the results, enabling a world in which reasonable access to information is not an option but a right. This is Stellar blockchain’s strength.

LOBSTR wallet

LOBSTR was one of the first XLM wallets that appeared on the market in 2014 and was formally registered as a Belarusian company. Ultra Stellar, LLC, which is a separate company, offers the LOBSTR wallet. Though it is not affiliated with the Stellar Development Foundation, you can instantly use the LOBSTR wallet to communicate with the Horizon Stellar API.

Refuge banking application

Many banking applications communicate with Stellar network via Horizon, a RESTful HTTP API server. Horizon allows you to manage your finances easily and perform activities. You can also register for Horizon activities, and the Stellar SDK Java library provides APIs to initiate money transfers and connect to Horizon.

Smart contracts

Using the Soroban platform, you can create turing complete smart contracts on the Stellar network.

How to build a Stellar App?

Let’s look at the below steps to understand how to build an app on the Stellar Blockchain Network.

Build a Stellar App | Stellar Blockchain App Development (1)

1. Install SDK based on the technology you want to use

The first step is to install an SDK based on the technology you want to use for building your app. For example, if you want to develop a Python-based app, you will be installing the Python SDK.

You can install the Python SDK via pip utility:

pip install stellar-base

Using this utility, the main SDK will be installed along with all dependencies. The Python SDK for Stellar apps provides a networking layer API for Horizon endpoints. It also allows you to build and sign transactions, communicate with a Stellar Horizon instance, query network history and communicate with a Stellar Horizon instance.

2. Connect the SDK with the Horizon Network

Once you have successfully installed the Python SDK, the next step is to connect it with the Horizon network. Horizon is the client-facing API Server for the Stellar blockchain ecosystem. It acts as a bridge between the Stellar core and applications that want to access the Stellar network. Horizon enables you to submit transactions to the network, subscribe to event streams and check the accounts’ status.

You can interact with Horizon directly via the cURL/web browser. Horizon has ledger endpoints that are used to stream ledger data. It has multiple endpoints that support the streaming of effects, ledgers, offers, operations, accounts, order books, transactions, payments and trades.

To start, you can import the Horizon object from the Python Stellar SDK. The horizon object allows accessing Horizon API endpoints. Then, you need to create two functions, one to manage responses from Horizon and one to call the Horizon/ledgers endpoint in the streaming mode. The handling function will print the response to the console that will look like:

from stellar_base.horizon import Horizondef data_handler(response): print(response)def get_ledger_data():if _name_ == '_main_':get_ledger_data()

The next step is to create the get_ledger_data() function that will perform actions, including creating a new horizon object, calling the ledgers endpoint in streaming mode and for each response, we will pass it to data_handler():

from stellar_base.horizon import Horizondef data_handler(response):print(response)def get_ledger_data():# Create new Horizon object (mainnet)ledger_data = Horizon(horizon_uri='https://horizon.stellar.org')# Send request to ledgers enpointledger_data = ledger_data.ledgers(cursor='now', order='asc', sse=True)# Handle responsesfor ledger in ledger_data:data_handler(ledger)if __name__ == '__main__':get_ledger_data()

Code line9 creates the new Horizon object and sets the horizon_uri to the main net (https://horizon.stellar.org./).

Line11 shows the calling of the /ledgers endpoint with some arguments. cursor=’now’ implies that we want to initiate returning records after the streaming object is created. order=’asc’ tells us the order in which we want to return rows, for example, in this case, ascending order. Lastly, in line11, sse=True implies that we want to use server-side events for streaming responses.

A for loop in line13 passes each response to the data_handler() function.

The python stellar SDK sends a get request to the ledgers endpoints and returns a dictionary with information from the /ledgers endpoint.

Python dictionaries are comprised of keys and values, for example, we use the relevant key to grab specific data. Here, we will only get data for successful and failed transactions, ledger sequence and total operations in the ledger.

3. Create an account

Once the SDK gets connected to the Horizon Server, the next step is to create an account on the Stellar Network. Accounts are used for holding all your money inside Stellar and enable you to receive and send payments.

Each stellar account has a secret seed and a public key. Stellar leverages public-key cryptography to make sure that every transaction is secure. The public key can be safely shared, and other people require it to identify your account and verify that you validated a transaction. However, the secret seed is private information that shows you own your account. You should not share the seed with anyone. It’s like the combination of a lock. Anyone who is aware of the combination can open the lock. In a similar way, anyone who knows your account’s seed can control your account.

The first step in creating an account is to create your own key and seed. Use the following command to generate the key and seed:

from stellar_sdk.keypair import Keypairpair = Keypair.random()print(f"Secret: {pair.secret}")# Secret: SCMDRX7A7OVRPAGXLUVRNIYTWBLCS54OV7UH2TF5URSG4B4JQMUADCYUprint(f"Public Key: {pair.public_key}")# Public Key: GAG7SXULMNWCW6LX42JKZOZRA2JJXQT23LYY32OXA6XECUQG7RZTQJHO

Once you have a seed and public key, you can create an account. To prevent people from making a huge number of unnecessary accounts, each account must have a minimum of 1 lumen. You cannot pay for an account if you don’t have any lumens. However, on Stellar testnet, you can ask Stellar’s Friendbot to create an account for you.

You need to send the public key to Friendbot for creating a test account. The bot will create and fund a new account with the public key as the account ID.

import requestspublic_key = "GD4NB2FLQAN5JO7PKPGZJMNBDYQXVSNVC7DEIZMOL5WSNSBLEBUTEF5Q"response = requests.get(f"https://friendbot.stellar.org?addr={public_key}")if response.status_code == 200:print(f"SUCCESS! You have a new account :)\n{response.text}")else: print(f"ERROR! Response: \n{response.text}")

The last step in creating an account is to get the account’s details and checking the balance.

from stellar_sdk.server import Serverserver = Server("https://horizon-testnet.stellar.org")public_key = "GD4NB2FLQAN5JO7PKPGZJMNBDYQXVSNVC7DEIZMOL5WSNSBLEBUTEF5Q"account = server.accounts().account_id(public_key).call()for balance in account['balances']:print(f"Type: {balance['asset_type']}, Balance: {balance['balance']}")

4. Creating different assets

The Stellar Distributed Network is used to hold, track and transfer any kind of asset: euros, dollars, stocks, gold, bitcoin and other tokens of value. Any asset on the Stellar network can be exchanged and traded with any other asset.

Apart from lumens, all assets on the Stellar have:

Asset type:e.g., BTC or USD
Issuer:the account that creates the asset

The object of the Asset class represents an asset in the stellar network. Currently, there can be three types of assets in the stellar network:

  • native XLM asset (ASSET_TYPE_NATIVE)
  • issued assets with asset code of a maximum of 12 characters (ASSET_TYPE_CREDIT_ALPHANUM12)
  • issued assets with asset code of maximum 4 characters (ASSET_TYPE_CREDIT_ALPHANUM4)

Use the static native() method to create a new native asset representation:
from stellar_sdk import
Asset native = Asset.native()

You have to create a new object of type Asset with an issuer and asset code for representing an issued asset:

fromstellar_sdkimportAsset#CreatesTESTassetissuedbyGBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBBtest_asset=Asset("TEST","GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB")is_native=test_asset.is_native()#False#CreatesGooglestockassetissuedbyGBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBBgoogle_stock_asset=Asset('US38259P7069','GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB')google_stock_asset_type=google_stock_asset.type#credit_alphanum12

You don’t need a dedicated operation to create an asset on the Stellar network. Instead, you can create an asset using a payment operation. An issuing account makes a payment with the asset it is issuing, and that payment is used to create the asset on the network.

The issuing asset makes a payment to the distribution account with the newly named asset. As long as the issuing account is unlocked, it can create new tokens by doing payments to the distribution account. If your plan is to do anything with the asset, the next step is to complete a stellar.toml file to provide exchanges, wallets, market listing services and token holders with the info they require to understand what it represents.

Once it is done, you can also create a sell offer to get your asset onto the Stellar decentralized exchange and put effort into market-making to create liquidity.

Here is the sample code for issuing an asset on the Stellar network:

from stellar_sdk.asset import Assetfrom stellar_sdk.keypair import Keypairfrom stellar_sdk.network import Networkfrom stellar_sdk.server import Serverfrom stellar_sdk.transaction_builder import TransactionBuilder# Configure Stellar SDK to talk to the horizon instance hosted by Stellar.org# To use the live network, set the hostname to 'https://horizon.stellar.org'server = Server(horizon_url="https://horizon-testnet.stellar.org")# Use test network, if you need to use public network, please set it to `Network.PUBLIC_NETWORK_PASSPHRASE` network_passphrase = Network.TESTNET_NETWORK_PASSPHRASE# Keys for accounts to issue and receive the new assetissuing_keypair = Keypair.from_secret("SCZANGBA5YHTNYVVV4C3U252E2B6P6F5T3U6MM63WBSBZATAQI3EBTQ4")issuing_public = issuing_keypair.public_keydistributor_keypair = Keypair.from_secret("SDSAVCRE5JRAI7UFAVLE5IMIZRD6N6WOJUWKY4GFN34LOBEEUS4W2T2D")distributor_public = distributor_keypair.public_key# Transactions require a valid sequence number that is specific to this account.# We can fetch the current sequence number for the source account from Horizon.distributor_account = server.load_account(distributor_public)# Create an object to represent the new assetastro_dollar = Asset("AstroDollar", issuing_public)# First, the receiving account must trust the assettrust_transaction = (TransactionBuilder(source_account=distributor_account,network_passphrase=network_passphrase,base_fee=100,)# The `changeTrust` operation creates (or alters) a trustline# The `limit` parameter below is optional.append_change_trust_op(asset_code=astro_dollar.code, asset_issuer=astro_dollar.issuer, limit="1000").set_timeout(100).build())trust_transaction.sign(distributor_keypair)trust_transaction_resp = server.submit_transaction(trust_transaction)print(f"Change Trust Transaction Resp:\n{trust_transaction_resp}")issuing_account = server.load_account(issuing_public)# Second, the issuing account actually sends a payment using the asset.payment_transaction = (TransactionBuilder(source_account=issuing_account,network_passphrase=network_passphrase,base_fee=100,).append_payment_op(destination=distributor_public,amount="10",asset_code=astro_dollar.code,asset_issuer=astro_dollar.issuer,).build())payment_transaction.sign(issuing_keypair)payment_transaction_resp = server.submit_transaction(payment_transaction)print(f"Payment Transaction Resp:\n{payment_transaction_resp}")

The distributor’s account then will hold both new Astrodollars and XLM.

5. Define transaction fees

To maintain the efficiency of the network and ledger spam, Stellar needs small transaction fees and a minimum account balance. Transactions on the Stellar can range from 1 to a defined limit of 100 operations. The fee for a transaction is calculated as:

Transaction fee = number of operations * base fee

Stellar deducts the fee from the transaction’s source account regardless of which accounts are involved in each operation or who signs the transaction.

6. Perform transactions

Transactions are the commands used to modify the state of a ledger, which include sending payments, making changes to account configurations, creating offers and so on. Each transaction has a source account that pays the fee and uses a sequence number for the transaction.

Transactions comprise one or more operations where each operation has a source account which is default to the transaction’s source account.

TransactionBuilder class is used for constructing new transactions. It is provided an account that is used as the transaction’s source account. The transaction uses the current sequence number of the given Account object as its sequence number and increases the given account’s sequence number when the build() function is called on the TransactionBuilder.

Operations can be added to the transaction by calling append_operation for every operation you want to add to the transaction. append_operation gives the TransactionBuilder object to allow you to chain multiple calls.

After you add the required operations, call the build() method on the TransactionBuilder. It will return an entirely constructed TransactionEnvelope. The TransactionEnvelope object wraps the transaction object, and the returned transaction consists of the sequence number of the source account. This transaction is unsigned; it needs to be signed before the Stellar network accepts it.

fromstellar_sdkimportTransactionBuilder,Network,Keypair,Accountroot_keypair=Keypair.from_secret("SA6XHAH4GNLRWWWF6TEVEWNS44CBNFAJWHWOPZCVZOUXSQA7BOYN7XHC")
#CreateanAccountobjectfromanaddressandsequencenumber.
root_account=Account(account_id=root_keypair.public_key,sequence=1)
transaction=TransactionBuilder(source_account=root_account,
#Ifyouwanttosubmittopubnet,youneedtochange`network_passphrase`to`Network.PUBLIC_NETWORK_PASSPHRASE`
network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE,base_fee=100)
\.append_payment_op(
#addapaymentoperationtothetransactiondestination="GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW",asset_code="XLM",amount="125.5")
\.append_set_options_op(#addasetoptionsoperationtothetransactionhome_domain="overcat.me")\.set_timeout(30)\.build()
#markthistransactionasvalidonlyforthenext30seconds

7. Creating a payment transaction

In the below example, there must be a destination account. We can use both synchronous and asynchronous methods to submit transactions. We have used the synchronous method in the following example:

Create, sign, and submit a transaction using Python Stellar SDK.

Assume that you have the following items:

  1. Secret key of a funded account to be the source account
  2. Public key of an existing account as a recipient These two keys can be created and funded by the friend bot at https://www.stellar.org/laboratory/ under the heading “Quick Start: Test Account”
  3. Access to Python Stellar SDK (https://github.com/StellarCN/py-stellar-base) through Python shell.
from stellar_sdk import Server, Keypair, TransactionBuilder, Network# The source account is the account we will be signing and sending from.source_secret_key = "SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD"# Derive Keypair object and public key (that starts with a G) from the secretsource_keypair = Keypair.from_secret(source_secret_key) source_public_key = source_keypair.public_key receiver_public_key = "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH"# Configure StellarSdk to talk to the horizon instance hosted by Stellar.org# To use the live network, set the hostname to 'horizon.stellar.org'server = Server(horizon_url="https://horizon-testnet.stellar.org")# Transactions require a valid sequence number that is specific to this account.# We can fetch the current sequence number for the source account from Horizon.source_account = server.load_account(source_public_key) base_fee = server.fetch_base_fee()# we are going to submit the transaction to the test network,# so network_passphrase is `Network.TESTNET_NETWORK_PASSPHRASE`,# if you want to submit to the public network, please use `Network.PUBLIC_NETWORK_PASSPHRASE`.transaction = ( TransactionBuilder( source_account=source_account, network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE, base_fee=base_fee, ) .add_text_memo("Hello, Stellar!") # Add a memo# Add a payment operation to the transaction# Send 350.1234567 XLM to receiver# Specify 350.1234567 lumens. Lumens are divisible to seven digits past the decimal..append_payment_op(receiver_public_key, "350.1234567", "XLM") .set_timeout(30)# Make this transaction valid for the next 30 seconds only.build() )# Sign this transaction with the secret key# NOTE: signing is transaction is network specific. Test network transactions# won't work in the public network. To switch networks, use the Network object # as explained above (look for stellar_sdk.network.Network).transaction.sign(source_keypair)# Let's see the XDR (encoded in base64) of the transaction we just builtprint(transaction.to_xdr())# Submit the transaction to the Horizon server. # The Horizon server will then submit the transaction into the network for us.response = server.submit_transaction(transaction) print(response)

The following is an example of sending a payment by an asynchronous method:

The effect of this example is the same as `payment.py`, but this example is asynchronous.

Create, sign, and submit a transaction using Python Stellar SDK.

Assume that you have the following items:
1. Secret key of a funded account to be the source account
2. Public key of an existing account as a recipient
These two keys can be created and funded by the friendbot at https://www.stellar.org/laboratory/ under the heading
“Quick Start:
Test Account”
3. Access to Python Stellar SDK (https://github.com/StellarCN/py-stellarbase) through Python shell.

import asynciofrom stellar_sdk import Server, Keypair, TransactionBuilder, Network, AiohttpClient# The source account is the account we will be signing and sending from.source_secret_key = "SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD"# Derive Keypair object and public key (that starts with a G) from the secretsource_keypair = Keypair.from_secret(source_secret_key)source_public_key = source_keypair.public_keyreceiver_public_key = "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH"async def main(): # Configure StellarSdk to talk to the horizon instance hosted by Stellar.org # To use the live network, set the hostname to 'horizon.stellar.org' # When we use the `with` syntax, it automatically releases the resources it occupies. async with Server( horizon_url="https://horizon-testnet.stellar.org", client=AiohttpClient() ) as server: # Transactions require a valid sequence number that is specific to this account. # We can fetch the current sequence number for the source account from Horizon. source_account = await server.load_account(source_public_key) base_fee = await server.fetch_base_fee() # we are going to submit the transaction to the test network, # so network_passphrase is `Network.TESTNET_NETWORK_PASSPHRASE`, # if you want to submit to the public network, please use `Network.PUBLIC_NETWORK_PASSPHRASE`. transaction = ( TransactionBuilder( source_account=source_account, network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE, base_fee=base_fee, ) .add_text_memo("Hello, Stellar!") # Add a memo # Add a payment operation to the transaction # Send 350.1234567 XLM to receiver # Specify 350.1234567 lumens. Lumens are divisible to seven digits past the decimal. .append_payment_op(receiver_public_key, "350.1234567", "XLM") .set_timeout(30) # Make this transaction valid for the next 30 seconds only .build() ) # Sign this transaction with the secret key # NOTE: signing is transaction is network specific. Test network transactions # won't work in the public network. To switch networks, use the Network object # as explained above (look for stellar_sdk.network.Network). transaction.sign(source_keypair) # Let's see the XDR (encoded in base64) of the transaction we just built print(transaction.to_xdr()) # Submit the transaction to the Horizon server. # The Horizon server will then submit the transaction into the network for us. response = await server.submit_transaction(transaction) print(response)if __name__ == "__main__": loop = asyncio.get_event_loop() loop.run_until_complete(main()) loop.close() # asyncio.run(main()) # Python 3.7+

In case a transaction requires multiple public keys for signing before they are considered valid, you need to use multi-signature accounts. It is done by configuring your account’s threshold levels. Every operation has either a low, medium or high threshold level.

You provide each threshold a level between 1-255 in your account. For each key in your account, you assign them a weight. Any transaction must be signed with enough keys to meet the threshold.

Suppose you set threshold levels as low=1, medium=2 and high=3. You have to send a payment operation which is a medium threshold operation and your master key has weight 1. Moreover, you have a secondary key associated with your account that has a weight of 1. Now, the transaction you are submitting for the payment must have both signatures of your secondary and master key because their combined weight is 2 that is enough to validate the payment operation.

In the below example, we will:

  • set our account’s master key weight and threshold levels
  • create a multi-signature transaction that sends a payment
  • add a second signer to the account
from stellar_sdk import Server, TransactionBuilder, Signer, Network, Keypairserver = Server(horizon_url="https://horizon-testnet.stellar.org")root_keypair = Keypair.from_secret("SA6XHAH4GNLRWWWF6TEVEWNS44CBNFAJWHWOPZCVZOUXSQA7BOYN7XHC")root_account = server.load_account(account_id=root_keypair.public_key)secondary_keypair = Keypair.from_secret("SAMZUAAPLRUH62HH3XE7NVD6ZSMTWPWGM6DS4X47HLVRHEBKP4U2H5E7")secondary_signer = Signer.ed25519_public_key(account_id=secondary_keypair.public_key, weight=1)transaction = TransactionBuilder(source_account=root_account,network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE,base_fee=100) \.append_set_options_op(master_weight=1, # set master key weightlow_threshold=1,med_threshold=2, # a payment is medium thresholdhigh_threshold=2, # make sure to have enough weight to add up to the high threshold!signer=secondary_signer) \.set_timeout(30) \.build()# only need to sign with the root signer as the 2nd signer won't# be added to the account till after this transaction completestransaction.sign(root_keypair)response = server.submit_transaction(transaction)print(response)# now create a payment with the account that has two signersdestination = "GBA5SMM5OYAOOPL6R773MV7O3CCLUDVLCWHIVVL3W4XTD3DA5FJ4JSEZ"transaction = TransactionBuilder(source_account=root_account,network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE,base_fee=100) \.append_payment_op(destination=destination,amount="2000",asset_code="XLM") \.set_timeout(30) \.build()# now we need to sign the transaction with both the root and the secondary_keypaitransaction.sign(root_keypair)transaction.sign(secondary_keypair)response = server.submit_transaction(transaction)print(response)

8. Monitoring

Once the network is set up and the node is up and running, it is essential to keep an eye to ensure the network is running efficiently. To help with monitoring, Stellar Core reveals vital information that you can use to monitor your node and identify potential problems.

You can access the information related to monitoring using commands and inspecting Stellar Core’s output. You can also connect the Prometheus server to enable easy and quick monitoring, merge it with Alertmanager to automate notification, and use pre-built Grafana dashboards for creating a visual representation of your node’s health.

You have to run $ stellar-core http-command ‘info’ command to check the overall health of the Stellar network.

Fields in the info contain:

  • build: the build number for Stellar Core Instance
  • peers: information about the network connectivity
    • pending_count: the number of connections that are not entirely established
    • authenticated_count: the number of live connections
  • protocol_version: the maximum version of the protocol that this instance recognizes
  • state: the node’s synchronization status relative to the network
  • ledger: the local state of your node that can be different from the network state if your node was disconnected from the network.

It is recommended that administrators should import the following dashboards into their grafana deployments:

  1. Stellar Core Monitoring:
    It shows the most crucial metrics and node status and is used to surface common problems.
  2. Stellar Core Full:
    It displays a simple health summary and all the metrics exposed by the stellar-core-prometheus-exporter. It provides more details than the Stellar Core Monitoring and is useful during in-depth troubleshooting.

We hope that we have been able to explain the complete process of building blockchain apps on the Stellar Blockchain Network. As mentioned above, you can build a wide array of apps or payment systems using the Stellar protocol.

Conclusion

Stellar aims to be a global payment standard. It was designed to be interoperable, linking the existing financial system with payment rails and new digital ones so that value flows seamlessly across borders. Stellar blockchain technology connects financial infrastructure regardless of where it is located so that all forms and types of value can be interoperable. This technology allows for greater access and inclusion. It helps us build a world in which equitable access is not a privilege but a right. This is the power of Stellar.

Our team of Stellar developers can help you design and develop any financial solution on top of the Stellar blockchain network. Contact us and get started with your Stellar app development project.

Build a Stellar App | Stellar Blockchain App Development (2024)
Top Articles
Here's What an Extra $50 a Month Could Do for Your Retirement Savings | The Motley Fool
I Can Only Afford to Save $100 a Month. What's the Smartest Thing I Can Do With It?
Victor Spizzirri Linkedin
Forozdz
Phone Number For Walmart Automotive Department
New Slayer Boss - The Araxyte
Es.cvs.com/Otchs/Devoted
<i>1883</i>'s Isabel May Opens Up About the <i>Yellowstone</i> Prequel
Mylaheychart Login
Imbigswoo
Luciipurrrr_
Tiger Island Hunting Club
Reddit Wisconsin Badgers Leaked
Springfield Mo Craiglist
Apus.edu Login
Hellraiser III [1996] [R] - 5.8.6 | Parents' Guide & Review | Kids-In-Mind.com
Indiana Wesleyan Transcripts
Clare Briggs Guzman
Shadbase Get Out Of Jail
683 Job Calls
Southland Goldendoodles
How Taraswrld Leaks Exposed the Dark Side of TikTok Fame
Kentuky Fried Chicken Near Me
Apparent assassination attempt | Suspect never had Trump in sight, did not get off shot: Officials
Violent Night Showtimes Near Amc Dine-In Menlo Park 12
Meet the Characters of Disney’s ‘Moana’
Keyn Car Shows
Meowiarty Puzzle
Lesson 1.1 Practice B Geometry Answers
Best Laundry Mat Near Me
Grays Anatomy Wiki
35 Boba Tea & Rolled Ice Cream Of Wesley Chapel
Rvtrader Com Florida
Los Amigos Taquería Kalona Menu
Culver's Hartland Flavor Of The Day
Www Violationinfo Com Login New Orleans
Drabcoplex Fishing Lure
Evil Dead Rise (2023) | Film, Trailer, Kritik
Mid America Irish Dance Voy
Lake Andes Buy Sell Trade
Bob And Jeff's Monticello Fl
Anderson Tribute Center Hood River
Foxxequeen
Big Reactors Best Coolant
Tacos Diego Hugoton Ks
Large Pawn Shops Near Me
Meet Robert Oppenheimer, the destroyer of worlds
Craigslist Free Cats Near Me
What your eye doctor knows about your health
Nkey rollover - Hitta bästa priset på Prisjakt
Turning Obsidian into My Perfect Writing App – The Sweet Setup
Varsity Competition Results 2022
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 5753

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.