Introducing Bytabit

Bytabit
6 min readOct 6, 2018

--

The mission of the Bytabit team is to provide one of the most secure, private, and convenient ways to buy and sell bitcoin. In this post I demonstrate (via video clips) the first version of our mobile bitcoin/fiat exchange app. The Bytabit app currently runs on Android phones and this alpha version demonstrates the “happy path” for exchanging bitcoin for national fiat currency without using an intermediate custodian for any part of the trade. This demo was performed on the public Bitcoin testnet3 network.

In place of a fully custodial, centralized exchange the Bytabit app holds the bitcoin (BTC) for each trade in a unique per trade 2 of 3 multisig address (P2SH). This “escrow account” is controlled jointly by the buyer, seller, and an arbitrator. The fiat currency payment for a trade is performed outside of our app using any non-reversible, person to person payment method such as the popular Swish network in Sweden. In the case of a non-contested “happy path” trade the buyer and seller sign the final transaction to release the purchased bitcoin to the buyer. If the the seller doesn't receive the expected fiat payment, or the buyer sends the payment but does not receive their bitcoin, then an arbitrator will collect evidence from both parties and provide the second signature to either refund the seller's bitcoin, or payout the bitcoin to the buyer.

Arbitrator

For the purpose of the demo described by this article the arbitrator does not play any direct roll and only provides their public key for use by the bitcoin buyer and seller in the construction of the escrow account address used for the trade. In a part two of this article I will demonstrate the “unhappy” trade paths that require the arbitrator to get more directly involved.

Seller

Step 1: Add Payment Details
First the seller sets up the payment details for the fiat currency they wish to receive in exchange for BTC. For our initial app the supported currency will be Swedish Krona (SEK) paid via Swish . The payment details for Swish include only the seller's phone number tied to their Swish account. This information will be sent to the buyer after a trade is created and funded.

Seller adds payment details.

Step 2: Create Offer
Next the seller creates an offer that includes the the currency, payment method, selected arbitrator, minimum and maximum amounts to trade, and the price per BTC. The below clip also shows the seller checking their in app wallet balance.

Seller creates an offer.

Step 3: Fund Trade Escrow with BTC
After a buyer accepts the seller’s offer and creates a new trade the seller sees the new trade in their trades view and opens it to see the details. The seller accepts the trade by clicking the FUND ESCROW button which sends the required BTC from the seller’s in-app wallet to the trade escrow account multisig address. The seller then checks their wallet again to see the correct amount (plus transaction fees) are deducted from their wallet balance.

Seller funds trade escrow account.

Step 4: Receive Fiat Payment from Buyer
After the buyer confirms that the escrow account for the trade was successfully funded they send their SEK via Swish to the seller (simulated for this testnet demo). Using the app, the buyer marks the trade as paid and their app sends the Swish transaction reference code and their bitcoin transaction signature to payout the escrowed bitcoins to themselves.

Seller receives buyer’s payment and payment reference.

Step 5: Payout Escrow BTC to Buyer
Once the seller confirms they received the Swish SEK payment from the buyer they click the PAYMENT RECEIVED button. This button triggers the app to create the transaction that releases the escrowed bitcoin to the buyer by adding the seller’s and buyer’s signatures and then sending the completed transaction to the bitcoin network.

Seller receives payment and releases escrow to buyer.

After the final payout transaction is confirmed on the bitcoin network the seller (and buyer) are shown that the trade status is changed to completed.

The trade is completed.

Buyer

Step 1: Take Offer
The buyer selects an offer from a seller to begin the trade process. After reviewing the details of the offer, the buyer enters the amount of BTC they would like to purchase and clicks the BUY button.

The buyer takes the seller’s offer.

Step 2: Create Trade
Upon taking the seller’s offer the app uses the buyer’s and seller’s public keys generated for this trade plus the arbitrators public key to create an escrow address for the trade. This information is then sent to the seller so that they can fund the escrow with the BTC that is to be purchased.

Seller takes a look a their newly created trade.

Step 3: Pay Seller with Fiat
When the seller funds the escrow account they also send the buyer their payment details so the buyer knows where to send the fiat currency side of the trade. After the buyer sends the seller the required amount of SEK they add the related payment reference information to the trade and mark the trade as PAID. Behind the scenes the app also adds the buyers signature to release the escrowed BTC and this information is sent to the seller.

The buyer see the trade escrow is funded and pays the buyer.

Step 4: Receive BTC from Seller
After the seller confirms that they received the buyer’s fiat payment their app creates and broadcasts the bitcoin transaction to send the buyer their purchased BTC. The buyer’s app wallet sees that the payout transaction was sent and marks the trade as completing.

The buyer sees that the seller released the escrowed BTC.

And finally after the buyer’s app wallet verifies that the payout transaction is confirmed in a Bitcoin block, then the trade is completed. The buyer can then also check their wallet to see the payout transaction and that their new BTC balance.

The trade is completed and the buyer has the purchased BTC.

Conclusion

Thank you for taking the time to read this article, I hope you see the potential in our project. If you have any suggestions for features you'd like to see please let us know. The team is mapping out our next phase of development and want to know what potential users would value most in a peer-to-peer non-custodial exchange.

--

--