0.0.23 • Published 5 years ago

pbtc v0.0.23

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

fbtc

This is an example of how to write a proof-of-stake Bitcoin sidechain.

This readme will walk you through depositing testnet Bitcoin into our running example sidechain.

Please, for the love of Satoshi, do not use this code to secure mainnet Bitcoin yet.

Depositing Bitcoin

First, make sure you've got some testnet Bitcoin. Here's a faucet where you can get some for free.

Install the fbtc command-line wallet:

$ npm install -g fbtc
$ fbtc

Usage: fbtc [command]

  Commands:
    
    balance                       Display your fbtc address and balance
    send      [address] [amount]  Send deposited coins to another address
    deposit                       Generate and display Bitcoin deposit address
    withdraw  [address] [amount]  Withdraw fbtc to a Bitcoin address

Now let's generate a Bitcoin deposit address.

This address is tied to your fbtc address; any Bitcoin sent to it will credit your fbtc address for the same amount:

$ fbtc deposit

Waiting for Bitcoin deposit to n4VQ5YdHf7hLQ2gWQYYrcxoE5B7nWuDFNF

This command won't exit right away. Leave it running. It is running a relayer to watch the Bitcoin blockchain for a deposit transaction. It will exit once your deposit succeeds.

Once this exits, check your fbtc balance:

$ fbtc balance

Your address: 4C2tiCHRkdnC1VAwGowvG2CTQr5kReJ3y
Your balance: 0.99999734

Now send 0.2 fbtc to your friend:

$ fbtc send JvP4JbpiWUUFgDVfX2f36wgi1wjDnVwzu 0.2

Withdrawing Bitcoin

Withdraw your remaining fbtc to any Bitcoin address like this:

$ fbtc withdraw 0.79943158 mtXWDB6k5yC5v7TcwKZHB89SUp85yCKshy

Your fbtc will be destroyed, and you'll receive an equivalent amount of Bitcoin (minus fees).

That's it!

Nomic is hiring

JavaScript hacker interested in rearchitecting the way humans organize themselves? Please get in touch.

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago