Files
payments-rest-api/README.md
2025-02-19 17:03:08 -06:00

2.1 KiB

Nodeless payments

Proof of concept implementation for deploying nodeless sdk as lambda function to AWS. This gives us a REST api with close to zero cost of hosting.

Currently implemented endpoints:

  • /send_payment (bolt11)
  • /receive_payment (bolt11)
  • /list_payments

Security:

  • for PoC purposes simple x-api-key header is added to the http calls and verified at each invocation. API secret is stored the same way as seed words and breez api key.
  • Encrypted secrets are stored in AWS Parameter Store and are accessed each time any endpoint is called (in the background docker container is started for each rest api call).

Requirements for deployment

Deployment

Deployment to AWS with cloudformation.

Install CLI

Follow AWS guide to install and configure cli.

Create SSM parameters for Breez credentials

aws ssm put-parameter \
    --name "/breez/api_key" \
    --value "<REPLACE_WITH_BREEZ_API_KEY>" \
    --type SecureString

aws ssm put-parameter \
    --name "/breez/seed_phrase" \
    --value "<REPLACE_WITH_SEED_WORDS>" \
    --type SecureString

aws ssm put-parameter \
    --name "/breez/api_secret" \
    --value "<REPLACE_WITH_DESIRED_API_AUTHENTICATION_KEY>" \
    --type SecureString

Deploy Cloudformation stack

aws cloudformation create-stack \
    --stack-name breez-integration \
    --template-body file://cloudformation.yaml \
    --capabilities CAPABILITY_IAM

# Monitor the stack creation
aws cloudformation describe-stacks \
    --stack-name breez-integration \
    --query 'Stacks[0].StackStatus'

Retrieve the API endpoints after successful deployment

aws cloudformation describe-stacks \
    --stack-name breez-integration \
    --query 'Stacks[0].Outputs'