I wanted to build an app that incorporated Blockstack and Twilio. I started by building another Blockstack app that helped me come up with the architecture and then I started thinking about how Twilio would be good for a decentralized application.
One thing that I've been wanting to do for a while is get rid of my cell phone. The biggest question I get is "what if people wanted to call or text you?". I got the idea that with Twilio I could offer a service for anonymous fully working phone numbers. To keep it anonymous you pay via lightning.
The side effect is that the service can also be used as a Lightning Pay Phone, anywhere in the world with an internet connection and at the same level anonymity as pay phones use to be.
What it does
When a new user visits they have the option to store all data locally (in localStorage in the browser) or to sign in with their Blockstack Id and have all of their information encrypted and stored in Gaia instead.
The site shows a list of available US numbers to purchase and allows the user to make the purchase via lightning. Once the number is purchased it is saved in the database with the preimage and a reference id that the browser set, not the server. The user also stores the preimage on their side and it combined with the reference id for that number are used to validate that the user "owns" that number. The user can then make and receive calls when clicking on that number.
How I built it
Blockstack Auth for optional authentication (it is the only authentication on the page, but is optional) Blockstack Gaia for optional storage (if no auth chosen it saves to localStorage, not to an API) Twilio WebRTC for connecting the users browser securely to the Twilio service so they can control their number LND / node.js server to handle the purchasing of numbers and assigning them after payments are made
There is a central service that runs simply to check who controls the number at the moment and to make sure they are paid up to use the service for that number. There is no personally identifying information sent to the backend other than a reference id the client randomly creates in the browser for each different interaction with the API.
Challenges I ran into
Working with the Twilio documentation was very challenging because they have a lot of conflicting docs and information available and it's not always clear which tool you should be using. I had to pay up front as well to even start on the project which was a challenge.
Accomplishments that I'm proud of
Really proud of the authentication scheme of using lightning network payment preimages for all authentication. The user is in charge of maintaining a list of phone numbers to preimages but they are in control of their own data, there are no personal identifiers in the db.
What I learned
WebRTC is pretty cool!
Also it's pretty easy to build a more decentralized website where the site itself is more of a service provider that the user is free to use (while protecting their personal information) with a minimal backend for processing payments and running 'contracts' on.
What's next for LightningVOIP
- Pay for a Designer :)
- Get voicemail working
- Add ability to "pick up" the voicemail call so you don't have to call someone back
- Get text send and receive working
- Add ability for type to speech so a user could also anonymize their voice for incoming calls