Create an Account
Before we get started with working with Lantah in code, consider going through the following examples using the Lantah Laboratory. The lab allows you create accounts, fund accounts on the Lantah test network, build transactions, run any operation, and inspect responses from Gravity via the Endpoint Explorer.
Accounts are a fundamental building block of Lantah: they hold all your balances, allow you to send and receive payments, and let you place offers to buy and sell assets. Since pretty much everything on Lantah is in some way tied to an account, the first thing you generally need to do when you start developing is create one. This beginner-level tutorial will show you how to do that.
Create a Keypair
Lantah uses public key cryptography to ensure that every transaction is secure: every Lantah account has a keypair consisting of a public key and a secret key. The public key is always safe to share — other people need it to identify your account and verify that you authorized a transaction. It’s like an email address. The secret key, however, is private information that proves you own — and gives you access to — your account. It’s like a password, and you should never share it with anyone.
Before creating an account, you need to generate your own keypair:
A valid keypair, however, does not make an account: in order to prevent unused accounts from bloating the ledger, Stellar requires accounts to hold a minimum balance of 1 Gram before they actually exist. Until it gets a bit of funding, your keypair doesn’t warrant space on the ledger.
On the public network, where live users make live transactions, your next step would be to acquire Grams, which you can do by consulting our Gram buying guide. **REMOVE BEFORE TAKEOFF** Friendbot not yet operational. Because this tutorial runs on the test network, you can get 10,000 test Grams from Friendbot, which is a friendly account funding tool.
To do that, send Friendbot the public key you created. It’ll create and fund a new account using that public key as the account ID.
Now for the last step: getting the account’s details and checking its balance. Accounts can carry multiple balances — one for each type of currency they hold.
Run a Node
Tier 1 Organizations
Run an API Server
Remote Captive Core
Software and SDKs
In the above code samples, proper error checking is omitted for brevity. However, you should always validate your results, as there are many ways that requests can fail. You should refer to the guide on Handling Errors Gracefully for tips on error management strategies.