This is a Node.js backend application that interacts with the Stellar blockchain network. It provides various endpoints for creating accounts, issuing assets, managing trustlines, and performing transactions on the Stellar network.
- Create Stellar accounts
- Issue custom assets
- Create trustlines
- Transfer assets
- Show account balances
- Display trustlines for an account
- Show issued assets for an account
- Node.js (v12 or higher)
- npm (Node Package Manager)
-
Clone the repository:
git clone https://github.com/SergeKhachatour/stellar-nodejs-backend.git cd stellar-nodejs-backend -
Install dependencies:
npm install -
Create a
.envfile in the root directory and add the following configuration:PORT=3000 HOST=localhost PROTOCOL=http API_KEY=stellar-api-key-654321 STELLAR_PROTOCOL=https STELLAR_SERVER=horizon-testnet.stellar.org STELLAR_NETWORK=TESTNET
-
Start the server:
npm start -
The server will start running at
http://localhost:3000(or as configured in your .env file).
All endpoints require authentication using an API key in the Authorization header.
- POST
/create-account: Create a new Stellar account - POST
/issue-asset: Issue a new custom asset - POST
/create-trustline: Create a trustline for an asset - POST
/transfer-asset: Transfer assets between accounts - POST
/show-balance: Show the balance of an account - POST
/show-trustlines: Show trustlines for an account - POST
/show-issued-assets: Show assets issued by an account
For detailed information on request/response formats for each endpoint, please refer to the API documentation.
This application uses a simple API key authentication mechanism. Make sure to keep your API key secure and not expose it in client-side code or public repositories.
PORT: The port number on which the server will run (default: 3000)HOST: The host address for the server (default: localhost)PROTOCOL: The protocol for the server (http or https)STELLAR_PROTOCOL: The protocol for connecting to the Stellar networkSTELLAR_SERVER: The Stellar network server addressSTELLAR_NETWORK: The Stellar network to connect to (TESTNET or PUBLIC)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.