Skip to main content

CLI Manual

Root Command

The stellar-disbursement-platform is the main entry point for the application. It provides various subcommands to manage the service, database, and other utilities.

Usage

stellar-disbursement-platform [command] [flags]
tip

For all the following commands, you can use the --help flag to get more information about the command and its options. For example:

stellar-disbursement-platform serve --help

Global Flags

The following flags are available for all commands:

FlagDescription
--base-urlThe SDP backend server's base URL. Defaults to http://localhost:8000.
--database-urlPostgres DB URL. Defaults to postgres://localhost:5432/sdp?sslmode=disable.
--environmentThe environment where the application is running. Example: development, staging, production. Defaults to development.
--log-levelThe log level used in this project. Options: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, or PANIC. Defaults to TRACE.
--network-passphraseThe Stellar network passphrase. Defaults to Test SDF Network ; September 2015.
--sdp-ui-base-urlThe SDP UI server's base URL. Defaults to http://localhost:3000.
--sentry-dsnThe DSN (client key) of the Sentry project. If not provided, Sentry will not be used.

Serve Command

The serve command starts the Stellar Disbursement Platform backend server. This server handles API requests, processes disbursements, and manages tenant operations.

Usage

stellar-disbursement-platform serve [flags]

Flags

FlagDescription
--admin-accountID of the admin account. To use, add to the request header as 'Authorization', formatted as Base64-encoded 'ADMIN_ACCOUNT:ADMIN_API_KEY'.
--admin-api-keyAPI key for the admin account. To use, add to the request header as 'Authorization', formatted as Base64-encoded 'ADMIN_ACCOUNT:ADMIN_API_KEY'.
--admin-portPort where the admin tenant server will be listening on. Defaults to 8003.
--aws-access-key-idThe AWS access key ID.
--aws-regionThe AWS region.
--aws-secret-access-keyThe AWS secret access key.
--aws-ses-sender-idThe email address that AWS will use to send emails. Uses AWS SES.
--aws-sns-sender-idThe sender ID of the AWS account sending the SMS message. Uses AWS SNS.
--bridge-api-keyBridge API key. This needs to be configured only if the Bridge integration is enabled.
--bridge-base-urlBridge Base URL. This needs to be configured only if the Bridge integration is enabled. Defaults to https://api.bridge.xyz.
--captcha-typeThe type of CAPTCHA to use. Options: GOOGLE_RECAPTCHA_V2, GOOGLE_RECAPTCHA_V3. Defaults to GOOGLE_RECAPTCHA_V2.
--channel-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt/decrypt the channel accounts' private keys. When not set, it will default to the value of the distribution-seed option.
--circle-api-typeThe Circle API type. Options: TRANSFERS, PAYOUTS. Defaults to TRANSFERS.
--cors-allowed-originsCors URLs that are allowed to access the endpoints, separated by ",".
--crash-tracker-typeCrash tracker type. Options: SENTRY, DRY_RUN. Defaults to DRY_RUN.
--db-conn-max-idle-time-secondsMaximum idle time in seconds before a connection is closed. Defaults to 10.
--db-conn-max-lifetime-secondsMaximum lifetime in seconds for a single connection. Defaults to 300.
--db-max-idle-connsMaximum number of idle DB connections retained per pool. Defaults to 2.
--db-max-open-connsMaximum number of open DB connections per pool. Defaults to 20.
--disable-mfaDisables the email Multi-Factor Authentication (MFA).
--disable-recaptchaDisables ReCAPTCHA for login and forgot password.
--distribution-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt and decrypt the private keys of tenants' distribution accounts.
--distribution-public-keyThe public key of the HOST's Stellar distribution account, used to create channel accounts.
--distribution-seedThe private key of the HOST's Stellar distribution account, used to create channel accounts.
--ec256-private-keyThe EC256 Private Key used to sign the authentication token. This EC key needs to be at least as strong as prime256v1 (P-256).
--email-sender-typeEmail Sender Type. Options: DRY_RUN, TWILIO_EMAIL, AWS_EMAIL. Defaults to DRY_RUN.
--enable-bridge-integrationEnable Bridge integration for Liquidity Sourcing.
--horizon-urlThe URL of the Stellar Horizon server where this application will communicate with. Defaults to https://horizon-testnet.stellar.org/.
--instance-nameName of the SDP instance. Example: SDP Testnet.
--max-base-feeThe max base fee for submitting a Stellar transaction. Defaults to 10000.
--max-invitation-resend-attemptsThe maximum number of attempts to resend the invitation to the Receiver Wallets. Defaults to 3.
--metrics-portPort where the metrics server will be listening on. Defaults to 8002.
--metrics-typeMetric monitor type. Options: PROMETHEUS. Defaults to PROMETHEUS.
--portPort where the server will be listening on. Defaults to 8000.
--recaptcha-site-keyThe Google 'reCAPTCHA v2 - I'm not a robot' site key.
--recaptcha-site-secret-keyThe Google 'reCAPTCHA v2 - I'm not a robot' site SECRET key.
--recaptcha-v3-min-scoreThe minimum score threshold for reCAPTCHA v3 (0.0 to 1.0, where 1.0 is very likely a good interaction). Only used when captcha-type is GOOGLE_RECAPTCHA_V3. Defaults to 0.5.
--reset-token-expiration-hoursThe expiration time in hours of the Reset Token. Defaults to 24.
--scheduler-payment-job-secondsThe interval in seconds for the payment jobs that synchronize transactions between SDP and TSS. Must be greater than 5 seconds. Defaults to 30.
--scheduler-receiver-invitation-job-secondsThe interval in seconds for the receiver invitation job that sends invitations to new receivers. Must be greater than 5 seconds. Defaults to 30.
--sep10-client-attribution-requiredIf true, SEP-10 authentication requires client_domain to be provided and validated. If false, client_domain is optional. Defaults to true.
--sep10-signing-private-keyThe private key of the Stellar account that signs the SEP-10 transactions. It's also used to sign URLs.
--sep10-signing-public-keyThe public key of the Stellar account that signs the SEP-10 transactions. It's also used to sign URLs.
--sep24-jwt-secretThe JWT secret that's used to sign the SEP-24 JWT token.
--single-tenant-modeThis option enables the Single Tenant Mode feature. In the case where multi-tenancy is not required, this options bypasses the tenant resolution by always resolving to the default tenant configured in the database.
--sms-sender-typeSMS Sender Type. Options: DRY_RUN, TWILIO_SMS, TWILIO_WHATSAPP, AWS_SMS. Defaults to DRY_RUN.
--tenant-xlm-bootstrap-amountThe amount of the native asset that will be sent to the tenant distribution account from the host distribution account when it's created if applicable. Defaults to 5.
--twilio-account-sidThe SID of the Twilio account.
--twilio-auth-tokenThe Auth Token of the Twilio account.
--twilio-sendgrid-api-keyThe API key of the Twilio SendGrid account.
--twilio-sendgrid-sender-addressThe email address that Twilio SendGrid will use to send emails.
--twilio-service-sidThe service ID used within Twilio to send messages.
--twilio-whatsapp-from-numberThe WhatsApp Business number used to send messages (with whatsapp: prefix).
--twilio-whatsapp-receiver-invitation-template-sidThe Twilio Content SID for WhatsApp receiver invitation template (starts with HX).
--twilio-whatsapp-receiver-otp-template-sidThe Twilio Content SID for WhatsApp receiver OTP template (starts with HX).

TSS Command

The tss command runs the Transaction Submission Service, which is responsible for submitting transactions to the Stellar network.

Usage

stellar-disbursement-platform tss [flags]

Flags

FlagDescription
--channel-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt/decrypt the channel accounts' private keys. When not set, it will default to the value of the distribution-seed option.
--crash-tracker-typeCrash tracker type. Options: SENTRY, DRY_RUN. Defaults to DRY_RUN.
--db-conn-max-idle-time-secondsMaximum idle time in seconds before a connection is closed. Defaults to 10.
--db-conn-max-lifetime-secondsMaximum lifetime in seconds for a single connection. Defaults to 300.
--db-max-idle-connsMaximum number of idle DB connections retained per pool. Defaults to 2.
--db-max-open-connsMaximum number of open DB connections per pool. Defaults to 20.
--distribution-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt and decrypt the private keys of tenants' distribution accounts.
--distribution-public-keyThe public key of the HOST's Stellar distribution account, used to create channel accounts.
--distribution-seedThe private key of the HOST's Stellar distribution account, used to create channel accounts.
--horizon-urlThe URL of the Stellar Horizon server where this application will communicate with. Defaults to https://horizon-testnet.stellar.org/.
--max-base-feeThe max base fee for submitting a Stellar transaction. Defaults to 10000.
--num-channel-accountsNumber of channel accounts to utilize for transaction submission. Defaults to 2.
--queue-polling-intervalPolling interval (seconds) to query the database for pending transactions to process. Defaults to 6.
--tss-metrics-portPort where the metrics server will be listening on. Defaults to 9002.
--tss-metrics-typeMetric monitor type. Options: TSS_PROMETHEUS. Defaults to TSS_PROMETHEUS.

DB Command

The db command provides utilities for database management and migrations. It performs two main functions:

  1. Running database migrations for various schemas (admin, auth, sdp, tss).
  2. Setting up assets and wallets based on the network passphrase.

Usage

stellar-disbursement-platform db [command] [flags]

Subcommands

CommandDescription
adminAdmin migrations for multi-tenant module.
authAuthentication schema migrations.
sdpSDP schema migrations.
setup-for-networkSet up assets and wallets based on network passphrase.
tssTSS schema migrations.

DB Admin

The db admin command manages the migrations for the admin schema, which handles multi-tenancy configuration.

Usage

stellar-disbursement-platform db admin [command] [flags]

Subcommands

CommandDescription
migrateSchema migration helpers.

DB Admin Migrate

The migrate command allows you to run migrations up or down.

Usage

stellar-disbursement-platform db admin migrate [command] [flags]

Subcommands

CommandDescription
upMigrates database up [count] migrations
downMigrates database down [count] migrations

Examples

# Apply all pending migrations
stellar-disbursement-platform db admin migrate up

# Apply the next 2 migrations
stellar-disbursement-platform db admin migrate up 2

# Revert the last migration
stellar-disbursement-platform db admin migrate down 1

DB Auth

The db auth command manages the migrations for the authentication schema.

Usage

stellar-disbursement-platform db auth [command] [flags]

Flags

FlagDescription
--allApply the command to all tenants. Either --tenant-id or --all must be set, but the --all option will be ignored if --tenant-id is set.
--tenant-idThe tenant ID where the command will be applied.

Subcommands

CommandDescription
migrateSchema migration helpers.

DB Auth Migrate

Similar to admin migrate, this command accepts up and down subcommands.

Examples

# Apply migrations for a specific tenant
stellar-disbursement-platform db auth migrate up --tenant-id <tenant-id>

# Apply migrations for all tenants
stellar-disbursement-platform db auth migrate up --all

DB SDP

The db sdp command manages the migrations for the SDP (Stellar Disbursement Platform) schema, which contains the core business logic tables.

Usage

stellar-disbursement-platform db sdp [command] [flags]

Flags

FlagDescription
--allApply the command to all tenants. Either --tenant-id or --all must be set, but the --all option will be ignored if --tenant-id is set.
--tenant-idThe tenant ID where the command will be applied.

Subcommands

CommandDescription
migrateSchema migration helpers.

DB SDP Migrate

Similar to admin migrate, this command accepts up and down subcommands.

Examples

# Apply migrations for a specific tenant
stellar-disbursement-platform db sdp migrate up --tenant-id <tenant-id>

# Apply migrations for all tenants
stellar-disbursement-platform db sdp migrate up --all

DB TSS

The db tss command manages the migrations for the TSS (Transaction Submission Service) schema.

Usage

stellar-disbursement-platform db tss [command] [flags]

Subcommands

CommandDescription
migrateSchema migration helpers.

DB TSS Migrate

Similar to admin migrate, this command accepts up and down subcommands.

Examples

# Apply all pending migrations
stellar-disbursement-platform db tss migrate up

DB Setup For Network

The db setup-for-network command sets up the assets and wallets registered in the database based on the network passphrase. It inserts or updates the entries of these tables according to the configured Network Passphrase.

Usage

stellar-disbursement-platform db setup-for-network [flags]

Flags

FlagDescription
--allApply the command to all tenants. Either --tenant-id or --all must be set, but the --all option will be ignored if --tenant-id is set.
--tenant-idThe tenant ID where the command will be applied.

Example

# Setup for a specific tenant
stellar-disbursement-platform db setup-for-network --tenant-id <tenant-id>

# Setup for all tenants
stellar-disbursement-platform db setup-for-network --all

Auth Command

The auth command provides helpers for authentication management, specifically for adding users to the system.

Usage

stellar-disbursement-platform auth [command] [flags]

Subcommands

CommandDescription
add-userAdd user to the system.

Auth Add User

The auth add-user command adds a new user to the system. The email must be unique, and the password must be at least 12 characters long.

Usage

stellar-disbursement-platform auth add-user <email> <first name> <last name> [flags]

Flags

FlagDescription
--ownerSet the user as Owner (superuser). Defaults to "false".
--passwordSets the user password. It should be at least 12 characters long. If omitted, the command will generate a random one.
--rolesSet the user roles. It should be comma-separated. Example: role1, role2. Available roles: owner, financial_controller, developer, business, initiator, approver.
--tenant-idThe tenant ID to which the user will be added.

Example

To add a new user with specific roles and a password:

stellar-disbursement-platform auth add-user [email protected] Mary Jane \
--roles approver,initiator --password \
--tenant-id 'f347e6b0-249c-4960-b0d2-aebcf4c6a60d'

Channel Accounts Command

The channel-accounts command manages channel accounts used for transaction submission.

Usage

stellar-disbursement-platform channel-accounts [command] [flags]

Flags

FlagDescription
--crash-tracker-typeCrash tracker type. Options: SENTRY, DRY_RUN. Defaults to DRY_RUN.
--distribution-public-keyThe public key of the HOST's Stellar distribution account, used to create channel accounts.
--tss-metrics-portPort where the metrics server will be listening on. Defaults to 9002.
--tss-metrics-typeMetric monitor type. Options: TSS_PROMETHEUS. Defaults to TSS_PROMETHEUS.

Subcommands

CommandDescription
createCreate channel accounts.
deleteDelete a specified channel account.
ensureEnsure a specific number of channel accounts exist.
verifyVerify channel accounts exist on the network.
viewList public keys of all channel accounts.

Channel Accounts Create

The create command creates channel accounts.

Usage

stellar-disbursement-platform channel-accounts create [count] [flags]

Flags

FlagDescription
--channel-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt/decrypt the channel accounts' private keys. When not set, it will default to the value of the distribution-seed option.
--distribution-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt and decrypt the private keys of tenants' distribution accounts.
--distribution-seedThe private key of the HOST's Stellar distribution account, used to create channel accounts.
--horizon-urlThe URL of the Stellar Horizon server where this application will communicate with. Defaults to https://horizon-testnet.stellar.org/.
--max-base-feeThe max base fee for submitting a Stellar transaction. Defaults to 10000.

Channel Accounts Delete

The delete command deletes a specified channel account from storage and on the network.

Usage

stellar-disbursement-platform channel-accounts delete [flags]

Flags

FlagDescription
--channel-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt/decrypt the channel accounts' private keys. When not set, it will default to the value of the distribution-seed option.
--channel-account-idThe ID of the channel account to delete.
--delete-all-accountsDelete all managed channel accounts in the database and on the network.
--distribution-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt and decrypt the private keys of tenants' distribution accounts.
--distribution-seedThe private key of the HOST's Stellar distribution account, used to create channel accounts.
--horizon-urlThe URL of the Stellar Horizon server where this application will communicate with. Defaults to https://horizon-testnet.stellar.org/.
--max-base-feeThe max base fee for submitting a Stellar transaction. Defaults to 10000.

Channel Accounts Ensure

The ensure command ensures that the specified number of channel accounts exist. If they do not exist, it will create them. If more channel accounts exist than specified, it will delete the excess accounts.

Usage

stellar-disbursement-platform channel-accounts ensure <count> [flags]

Flags

FlagDescription
--channel-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt/decrypt the channel accounts' private keys. When not set, it will default to the value of the distribution-seed option.
--distribution-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt and decrypt the private keys of tenants' distribution accounts.
--distribution-seedThe private key of the HOST's Stellar distribution account, used to create channel accounts.
--horizon-urlThe URL of the Stellar Horizon server where this application will communicate with. Defaults to https://horizon-testnet.stellar.org/.
--max-base-feeThe max base fee for submitting a Stellar transaction. Defaults to 10000.

Example

stellar-disbursement-platform channel-accounts ensure 5

Channel Accounts Verify

The verify command verifies that all the channel accounts in the database exist on the Stellar network.

Usage

stellar-disbursement-platform channel-accounts verify [flags]

Flags

FlagDescription
--channel-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt/decrypt the channel accounts' private keys. When not set, it will default to the value of the distribution-seed option.
--delete-invalid-accountsDelete channel accounts from storage that are verified to be invalid on the network.
--distribution-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt and decrypt the private keys of tenants' distribution accounts.
--distribution-seedThe private key of the HOST's Stellar distribution account, used to create channel accounts.
--horizon-urlThe URL of the Stellar Horizon server where this application will communicate with. Defaults to https://horizon-testnet.stellar.org/.
--max-base-feeThe max base fee for submitting a Stellar transaction. Defaults to 10000.

Channel Accounts View

The view command lists public keys of all channel accounts currently stored in the database.

Usage

stellar-disbursement-platform channel-accounts view [flags]

Distribution Account Command

The distribution-account command manages the distribution account.

Usage

stellar-disbursement-platform distribution-account [command] [flags]

Flags

FlagDescription
--crash-tracker-typeCrash tracker type. Options: SENTRY, DRY_RUN. Defaults to DRY_RUN.
--distribution-public-keyThe public key of the HOST's Stellar distribution account, used to create channel accounts.

Subcommands

CommandDescription
rotateRotate the distribution account for a tenant.

Distribution Account Rotate

The rotate command rotates the distribution account for a tenant.

Usage

stellar-disbursement-platform distribution-account rotate [flags]

Flags

FlagDescription
--channel-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt/decrypt the channel accounts' private keys. When not set, it will default to the value of the distribution-seed option.
--distribution-account-encryption-passphraseA Stellar-compliant ed25519 private key used to encrypt and decrypt the private keys of tenants' distribution accounts.
--distribution-seedThe private key of the HOST's Stellar distribution account, used to create channel accounts.
--horizon-urlThe URL of the Stellar Horizon server where this application will communicate with. Defaults to https://horizon-testnet.stellar.org/.
--max-base-feeThe max base fee for submitting a Stellar transaction. Defaults to 10000.
--tenant-idThe tenant ID where the command will be applied.
--tenant-xlm-bootstrap-amountThe amount of the native asset that will be sent to the tenant distribution account from the host distribution account when it's created if applicable. Defaults to 5.

Example

To rotate the distribution account for a specific tenant:

stellar-disbursement-platform distribution-account rotate --tenant-id 'f347e6b0-249c-4960-b0d2-aebcf4c6a60d'

Message Command

The message command provides messenger related commands.

Usage

stellar-disbursement-platform message [command] [flags]

Flags

FlagDescription
--aws-access-key-idThe AWS access key ID.
--aws-regionThe AWS region.
--aws-secret-access-keyThe AWS secret access key.
--aws-ses-sender-idThe email address that AWS will use to send emails. Uses AWS SES.
--aws-sns-sender-idThe sender ID of the aws account sending the SMS message. Uses AWS SNS.
--message-sender-typeMessage Sender Type. Options: TWILIO_SMS, TWILIO_WHATSAPP, TWILIO_EMAIL, AWS_SMS, AWS_EMAIL, DRY_RUN.
--twilio-account-sidThe SID of the Twilio account.
--twilio-auth-tokenThe Auth Token of the Twilio account.
--twilio-sendgrid-api-keyThe API key of the Twilio SendGrid account.
--twilio-sendgrid-sender-addressThe email address that Twilio SendGrid will use to send emails.
--twilio-service-sidThe service ID used within Twilio to send messages.
--twilio-whatsapp-from-numberThe WhatsApp Business number used to send messages (with whatsapp: prefix).
--twilio-whatsapp-receiver-invitation-template-sidThe Twilio Content SID for WhatsApp receiver invitation template (starts with HX).
--twilio-whatsapp-receiver-otp-template-sidThe Twilio Content SID for WhatsApp receiver OTP template (starts with HX).

Subcommands

CommandDescription
sendSend a message.

Message Send

The send command sends a message to a recipient.

Usage

stellar-disbursement-platform message send [flags]

Flags

FlagDescription
--emailThe email to send the message to. Mandatory if sending an email.
--messageThe text of the message to be sent.
--phone-numberThe phone number to send the message to, in E.164. Mandatory if sending an SMS.
--titleThe title to be set in the email. Mandatory if sending an email.

Example

# Send an SMS
stellar-disbursement-platform message send --phone-number "+1234567890" --message "Hello World" --message-sender-type TWILIO_SMS

# Send an Email
stellar-disbursement-platform message send --email "[email protected]" --title "Hello" --message "Hello World" --message-sender-type AWS_EMAIL