Sending Stellar Lumens ($XLM) using AWS Alexa (POC)

rav3n
3 min readApr 19, 2019

I’ve been itching to do another Alexa Skill since January. Mostly because I don’t get to do Lambda or any serverless stuff for my every day job.

This post is more of a proof-of-concept.

I’ll be demonstrating sending lumens to two friends over the Stellar test network. Before this can be done, I need to create two friend accounts and give them some lumens on the test network. The Stellar test network provides the Friendbot; a tool that developers can use to get testnet lumens (10000) for testing purposes. Sort of makes you feel rich?

I created a little python script to do this — check it here.

Run this and it will spit out the public address and seed keys. You’ll need your public address and seed key for the environment variables (understand the risks). You’ll also need only the public address of both friends.

The rest of this is all Lambda and Alexa. If you’re read any of my previous posts, its pretty much the same setup so I’m going to move through this a little fast. That being the following:

  1. Create a lambda_package
mkdir lumens
cd lumens
virtualenv --python=/usr/local/bin/python3.7 .
source bin/activate
pip install ask-sdk
pip install requests
pip install stellar-base
pip install requests
pip install pprint
pip install mnemonic
pip install pure25519
pip install toml
deactivate
vi lib/python3.7/site-packages/lambda_function.py
# copy + paste + save code from github repo found here:
# https://github.com/pyraven/alexa-stellar-lumens/blob/master/lambda_function.py
cd lib/python3.7/site-packages/
zip -r9 lambda_package.zip .

NOTE: There is a little “address book” on line 28 of the lambda_function.py file. It’s a little dictionary that Alexa will lookup.

2. Create new Lambda Function and upload zip file

3. Set environment variables and increase runtime (at least 15 seconds)

Also make sure the handler is set as shown below:

4. Create an Alexa start session test event and make sure its all good and green.

5. Add an Alexa trigger (left-side) and open a new tab to the Alexa developer portal

6. Create a new skill from scratch and upload the JSON in the repo found here.

7. Change the invocation if you wish. Save and build model.

8. Under Endpoint copy the skill ID over to your lambda function, save, and then copy your lambda function ARN (Amazon Resource Name) over to the default region in the developer portal

9. Start testing — screenshots below

Static Price of $200,000 in the logic

Proof on the Stellar Testnet Explorer:

Welp, its going to be a while before I can afford a lambo… so I guess I’m HODLing.

Hope this was helpful. Thanks for reading!

--

--