Follow these instructions to get started with the Stellar Disbursement Platform (SDP).
Make sure you have Docker installed on your system. If not, you can download it from here.
We will need to create and configure two Stellar accounts to be able to use the SDP.
- A Distribution account that will be used for sending funds to receivers. Create and Fund a Distribution Account
- A SEP-10 account that will be used for authentication. It can be created the same way as the distribution account but it doesn't need to be funded.
The public and private key of these two accounts will be used to configure the SDP in the next step.
- Navigate to the
dev
directory from the terminal:
cd dev
- Create a
.env
file in thedev
directory by copying the.env.example
file:
cp .env.example .env
-
Update the
.env
file with the public and private keys of the two accounts created in the previous step. -
Execute the following command to create all the necessary Docker containers needed to run SDP as well as provision sample tenants:
./main.sh
Tip
If you wish to start the sdp containers with monitoring services, you can use the docker-compose-monitoring.yml file
docker-compose -f docker-compose.yml -f docker-compose-monitoring.yml up
This will spin up the following services:
sdp_v2_database
: The main SDP and TSS database.anchor-platform-postgres-db
: Database used by the anchor platform.anchor-platform
: A local instance of the anchor platform.sdp-api
: SDP service running on port8000
.sdp-tss
: Transaction Submission service.sdp-frontend
: SDP frontend service running on port3000
.kafka
: Kafka service running on ports9092
,9094
(external).kafka-init
: Initial workflow to exec into the Kafka container and create topics.demo-wallet
: The demo wallet client that will be used as a receiver wallet, running on port4000
.
The following are optional monitoring services that can be started through docker-compose-monitoring.yml
and are primarily used for monitoring Kafka:
db-conduktor
: Database instance for the Conduktor service.conduktor-monitoring
: Conduktor Monitoring service integrated into the Conduktor Platform.conduktor-platform
: Provides solutions for Kafka management, testing, monitoring, data quality, security, and data governance.
When you ran main.sh
file, you've already created new tenants: tenants=("redcorp" "bluecorp")
.
To add more tenants, simply append them separated by spaces to that variable like so: tenants=("redcorp" "bluecorp" "greencorp")
and run main.sh
again.
Be sure that the added tenant hosts are included in the host configuration file.
To check it, you can run the command cat /etc/hosts
.
To include them, you can run command sudo nano /etc/hosts
and insert the lines below:
127.0.0.1 bluecorp.sdp.local
127.0.0.1 redcorp.sdp.local
Go through the forgot password flow to be able to login as an owner user.
Go to Forgot Password page on http://${tenant}.stellar.local:3000/forgot-password
and enter the tenant and owner email owner@${tenant}.org
.
A token will be generated, and it's possible to check it on sdp-api
logs. This token will be needed to Reset Password on http://${tenant}.stellar.local:3000/reset-password
.
Note
In the following section, we will assume you're using the bluecorp
tenant that was provisioned by default when you ran main.sh
.
Navigate to the frontend service by opening a browser and going to http://bluecorp.stellar.local:3000.
- Click
New Disbursement+
on the Dashboard screen. - Use
Demo Wallet
as your wallet and choose a verification method. - Upload a disbursement file. A sample file is available
./dev/sample/sample-disbursement.csv
. Make sure to update the invalid phone number before using it. - Finally, confirm the disbursement.
To deposit money into your account:
- Access demo-wallet in your browser.
- Click on
Generate Keypair for new account
to generate a new keypair. Make sure to save your public key & secret if you want to use this account later. - Click
Create account
(in front of public key) to actually create the account on the Stellar testnet. - Your newly created account will have 10,000 XLM.
- Add your home domain to the account by clicking on
Add Home Domain
and enteringhttp://bluecorp.stellar.local:8000
. - In the
Select action
dropdown, selectSEP-24 Deposit
. - In the new window, enter the phone number from the disbursement CSV.
- Enter the passcode. You can use
000000
passcode or find the actual passcode in thesdp-api
container logs. - Enter the birthday that matches the phone number in the CSV.
- Keep an eye on the dashboard until the payment status reaches
Success
. If everything was set up correctly, your money should be disbursed successfully.
Payments will start failing if the distribution account runs out of funds. To fix this, you can either write a script that funds the distribution account or use the tools available to add more funds to the distribution account by following these steps:
- Find the distribution account public key in
dev/docker-compose.yml
under the variableDISTRIBUTION_PUBLIC_KEY
- Access https://horizon-testnet.stellar.org/accounts/:accountId in your browser and check the balance.
- If the balance is indeed low, you can add more funds by creating a new account and sending funds to the distribution account.
- Access https://demo-wallet.stellar.org/ in your browser.
- Click on
Generate Keypair for new account
to create a new testnet account. Your account comes with 10,000 XLM. - Click on
Send
and enter the distribution account public key and the amount you want to send. - Using Freighter or Stellar Laboratory, swap the XLM for USDC if you wish to test with USDC.
You can also just use the newly created account as the distribution account by updating the DISTRIBUTION_PUBLIC_KEY
variable in dev/docker-compose.yml
and restarting the sdp-api
container.