The Stellar network is an open source, distributed blockchain based ledger and database that facilitates cross-asset transfers of value, including payments. The native digital asset of Stellar is called Lumens (XLM). In other words, Stellar is the payment network (Horizon API and Stellar Core) and Lumens (XLM) is the cryptocurrency.
Most applications can interact with the stellar network through Horizon which is a RESTful HTTP API server. It allows us to submit transactions to the network, check the status of accounts, and subscribe to event streams.
Stellar supports multi-cross currency transactions as the Lumens is the digital currency that acts a bridge in order to facilitate multi-currency transactions. Transactions such as: sending money in EUR, and then receiving it in USD. XLM is the digital intermediary that allows for such a transaction to occur at a low cost.
How to create an account on stellar
For creating an account on stellar, we will require two keys: Public key and Secret key (secret seed).
- Public key, we can share with anyone. If someone wants to send us any Lumens, then they have to send it to this public key.
- And secret key, don’t need to share this key with anyone. This key is used to login to stellar account viewer. So, we need to store this key to a safe location.
We can generate this keys from account viewer as well as from the coding itself.
- If we want to generate key pair for a new account using account viewer, so we need to click on Generate button and sign in with Secret key as mentioned in below screenshot, then we can send the lumens to another account as well as can see the transaction history from the dashboard of account viewer.
- For developing the code, we need to use the classes available in given libraries. We can also refer the link for Creating Account through the code. From that first we need to generate public and secret keys. And for doing the transactions we need to use test account URL in code while creating an API call and pass the newly generated public key. When we run the code for creating an account, it’ll create and fund a new account using that public key as the account ID. We will be credited 10000.00 lumens, so now we can do the test payment transactions from one account to another account. Because in stellar, each account must have a minimum balance of 1 lumen.
Send and Receive Payments on stellar
If we need to do the operation of sending the payment, then we need to create a transaction. We can perform many operations in one transaction like sending payments, changing your account, or making offers to trade various kinds of currencies. If any operation in the transaction fails, they all will fail.
Every transaction costs a small fee known as base fee. This fee helps stop people from overloading the system with lots of transactions.
Earlier we have seen that we can do the payments using account viewer. But if we want to do the payments by developing the code then we need to write the code in our preferable language. For getting the demo code click here.
If we want to send the payment then we need to
- Mention secret key of sender and public key of receiver,
- Build the transaction by passing the operation type (like Payment Operation), asset type (like lumens) and amount to be transfer,
- We need to specify the type of asset we are sending—Stellar’s “native” currency is the lumen, but we can send any type of asset or currency we like, from dollars to bitcoin to any sort of asset.
- Send it to the stellar by submitting the transaction.
We don’t actually need to do anything to receive payments into a stellar account because if a payer makes a successful transaction to send assets, those assets will automatically be added to our account. We can check the balance by hitting different URL given in test URL or we can check it by coding using different library classes.
TatvaSoft being a custom software development company has a team stretch which continuously deep dive in the recent trends and brushes up their knowledge by creating the demos and working on the clients' requirements that strives on the challenging new technologies and make sure to accomplish the prerequisites. Blockchain and cryptocurrency being more of in the trends for the digital transaction now, we have work upon it actively.