I was inspired by talks by Ryan X. Charles on replacing the TCP with Bitcoin transactions. I thought that idea was interesting, but after thinking about it more I was convinced that by using nSequence transactions we can actually do this today! Some of the other work that affirmed my assumptions about the incentive structure and why this would work is listed below by Craig S. Wright and Peter Rizun:
What it does
This is a phone that hacks nSequence channels (and bloom filters) by using the fact that they update to broadcast voice data all over the Bitcoin network!
Essentially it takes your voice data, wraps it in a non-finalized Bitcoin transaction pushes it into the Bitcoin network. These packets are broadcast through the entire Bitcoin network via the transaction propagation protocol and a listener who has a bloom filter set for transactions from you will both be able to receive the transaction you've sent, unwrap the audio data you've sent and play it through there speakers. This happens every second with every second of your voice being broadcast through the Bitcoin network and every broadcast incrementing the sequence number ensuring a continuous stream of audio data.
Your peer (friend) then does the same thing in reverse and now you've got two-way audio, a phone!
tl;dr It's a phone on top of Bitcoin that uses the power of sending fast, big transactions over the Bitcoin network and replacing them with nSequence.
How we built it
I built this by using Bretton Gunnings rust-sv library, and the rust-portaudio library. There is a bunch of modules in the bitcoinphone repo each with a different purpose. I wrote thousands of lines of code and it's spaghetti-ish so it's tough to explain but essentially the domain module will show you all the synchronization logic, the audio module the logic as pertains to sending and receiving data, and the net module (the biggest module btw) handles all the connections to peers, maintaining connections and the other modules are for signing, transaction handling etc.
Challenges we ran into
The primary challenges were in integration, there are so many components that do so many different things. There is a module to fetch the data, create the transactions, connect to the network update peers, etc. It was hard doing integration.
The second biggest challenge was in cross platform support, after testing on windows this failed :/
Accomplishments that we're proud of
We were able to have (as far as I know) the first ever conversation on top of the Bitcoin protocol! The evidence is both in the video and the following transactions. Please note the non-finalized nSequence number in the transactions as it shows that the transactions were updated that many times:
There are many more on the Bitcoin SV blockchain and they can all be found by perusing OP_RETURN data with a "phone" prefix.
What we learned
We learned so much from this experience, here are some of the highlights:
- The Bitcoin SV network is capable of handling a LOT of bandwidth we only pushed it to 1.33Mb/s, but I'm sure it could handle more than that.
- We learned that miners currently have no minimums on the fees needed for nSequence transactions and that needs to change.
- We learned that INV packets have a default delay of 150ms.. This needs to go down to make this type of transaction better quality for users
- The website to watch bitcoin transactions bitcoinblocks.live seems to fail when we
What's next for BitcoinPhone
The most important thing for the BitcoinPhone is to integrate a UI on top of the current app to allow people to associate payments with phone calls directly. Wouldn't it be great if you could see a counter of the amount of money you're making with a specific phone call?
The next thing is to add peer discovery so that people could request calls with random people by broadcasting their status on the network through the same nSequence style as shown here.
Lastly, there is more refactoring and functionality to add in terms of sending the payment and updating in the nSequence transaction channel.
I plan to continue to work on this even well after the hackathon as it's too inspiring to put down. There is a lot of refactoring work to be done as this was just a prototype. I am so thrilled that this validated all my assumptions about Bitcoin and that it worked. If you ever want to demo this with me personally or need help trying to get it to run, please reach out :)