Requirements
Install the Stellar SDK Version required for your project. We are using and recommend the latest Protocol 20 supported SDK.
Networks Selection
Mainnet (also known as Pubnet or the Public Network) is the primary network used by applications in production. It connects to real financial rails and requires XLM to cover minimum balances, transaction fees, and rent.
Testnet is a smaller, free-to-use network maintained by the Stellar Development Foundation (SDF). It functions similarly to the Mainnet but doesn’t involve real money. Developers can test their applications on Testnet without any financial risk.
Friendbot is a Testnet Only faucet that funds Testnet accounts with fake XLM. Use Friendbot to request XLM for testing purposes. Be mindful of rate limits when using Friendbot.
Network Passphrases
By convention, the format of a passphrase is: [Network Name] ; [Month of Creation] [Year of Creation].
Current passphrases:
Mainnet: ‘Public Global Stellar Network ; September 2015’
Testnet: ‘Test SDF Network ; September 2015’
Horizon Configuration
Horizon is the client-facing API server for the Stellar network. It serves as the interface between your application and the Stellar Core network. Set the appropriate Horizon server URL based on the network you’re targeting:
Mainnet: Use the public Horizon instance provided by SDF or run your own.
Testnet: Use SDF’s free Horizon instance for Testnet.
Initialize your SDK with the correct network passphrase.
Pakana Components default to the Testnet network.
const StellarSdk = require('stellar-sdk');
// Initialize Stellar SDK with the desired network
const network = 'testnet'; // 'mainnet' for Mainnet
const serverUrl = network === 'testnet' ? 'https://horizon-testnet.stellar.org' : 'https://horizon.stellar.org';
const horizonServer = new StellarSdk.Server(serverUrl);
// Set the network passphrase
const networkPassphrase = network === 'testnet'
? 'Test SDF Network ; September 2015'
: 'Public Global Stellar Network ; September 2015';
C#
Install the Pakana - Stellar NuGet package via the NuGet Package Manager Console, or by adding the following line to your .csproj file.
.Net8.0 or greater is required.
StellarSDK Dependency will install automatically
dotnet add package Pakana.Stellar.Components
Javascript
*Current Version as of 2024-24-02*
<script src="https://cdnjs.cloudflare.com/ajax/libs/stellar-sdk/11.2.2/stellar-sdk.js"></script>
//Example of how to use the StellarSdk package via CDNJS
var StellarSdk = require('stellar-sdk');
var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');
server.loadAccount('GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW')
.then(function (account) {
console.log('Balances for account: ' + accountId);
account.balances.forEach(function (balance) {
console.log('Type:', balance.asset_type, ', Balance:', balance.balance);
});
});