├── bit_hexagon.png ├── fullnode_stuff.md ├── html_stuff.md ├── README.md ├── harddrive.md ├── api.md ├── pybitcointools_stuff.md └── big_picture.md /bit_hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zack-bitcoin/bithexagon/master/bit_hexagon.png -------------------------------------------------------------------------------- /fullnode_stuff.md: -------------------------------------------------------------------------------- 1 | * we need to confirm that we got paid. 2 | 3 | * given an address, we need to know its total balance. 4 | -------------------------------------------------------------------------------- /html_stuff.md: -------------------------------------------------------------------------------- 1 | * Title page explaining how it works. 2 | 3 | * A page listing open trades you can take part in. 4 | 5 | * A page for adding a trade to the open trades. 6 | 7 | * A page for displaying active trades you are involved in. It might display information for you to sign. It might include instructions like: "Don't release the crypto funds until you get paid in fiat". 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bithexagon 2 | 3 | This is a distributed bitcoin/fiat exchange. 4 | Each customer holds their own funds all the time. 5 | 6 | It is open source. The back end is in erlang. Bitcoin transactions are processed by pybitcointools, the python library by Vitalik Buterin. The front end is an html website. 7 | 8 | So far, only an outline written in English exists. 9 | 10 | ![alt text][logo] 11 | 12 | [logo]: https://github.com/zack-bitcoin/bithexagon/blob/master/bit_hexagon.png "Logo Title Text" 13 | 14 | -------------------------------------------------------------------------------- /harddrive.md: -------------------------------------------------------------------------------- 1 | * to store open trades, waiting for a partner. 2 | * amount to trade 3 | * price 4 | * safety deposit size 5 | * other safety deposit size 6 | * details about non-cryptocurrency payment 7 | * email address for first person. 8 | * trade id (don't reuse ids in the same 24 hour period.) 9 | 10 | * to store signatures for a part-ways completed trade, step 1 11 | * One signature moving funds into multi-sig. 12 | * store second email address. 13 | 14 | * to store signatures for a part-ways completed trade, step 2 15 | * Publishes tx that loads money into multi-sig. 16 | * Gives email addresses to each participant. 17 | 18 | * to store signatures for a part-ways completed trade, step 3 19 | * One signature for unlocking funds from multi-sig. 20 | 21 | * to store signatures for a part-ways completed trade, step 4 22 | * Has both unlocking signatures. Either records it as a success, or a weird situation. 23 | 24 | * to store data that we asked a user to sign to prove control of an address. -------------------------------------------------------------------------------- /api.md: -------------------------------------------------------------------------------- 1 | * propose new trade 2 | * buy/sell bitcoin 3 | * amount in bitcoins 4 | * type of fiat 5 | * amount in fiat 6 | * details of non-blockchain money transfer. 7 | * bitcoin address 8 | * email address 9 | * solution to captcha 10 | * security deposit for you 11 | * security deposit for your partner 12 | 13 | * list open trades (these are traders who don't have partners yet. You can accept their offers.) 14 | 15 | * accept a trade 16 | * signature for the bitcoin address 17 | * email address 18 | * bitcoin address 19 | * trade id 20 | 21 | * trade 2 22 | * signature from bitcoin address 23 | * trade id 24 | 25 | * finish trade (this happens twice. Once for each participant. ) 26 | * trade id 27 | * signature from bitcoin address for unlocking funds from multisig. 28 | 29 | * cancel trade (can only be canceled if you both cancel) 30 | * trade id 31 | * signature for bitcoin address used in multisig. over some data provided by server. 32 | 33 | * list my trades (this is where you see your partner's email or phone number when it is time). 34 | 35 | 36 | -------------------------------------------------------------------------------- /pybitcointools_stuff.md: -------------------------------------------------------------------------------- 1 | * given 2 addresses, we need to be able to make multisig addresses. 2 | * mk_multisig_script : (pubkeys, k, n) -> k-of-n multisig script from pubkeys 3 | * scriptaddr : (script) -> P2SH address 4 | 5 | * We need to be able to make a tx with many inputs, to be signed by 2 different people, with the 2 of 2 as an output, and 2 change outputs. 6 | * mktx(ins, outs) 7 | 8 | 9 | * We need the ability to make a tx that spends from a 2 of 2 to 3 seperate people. 10 | * mktx : (inputs, outputs) -> tx 11 | 12 | * We need the ability to take 2 partially signed transactions, or 2 signatures, and make it into one transaction that is completely signed. 13 | * deserialize : (hex or bin transaction) -> JSON tx 14 | * apply_multisignatures: (tx, i, script, sigs) -> tx with index i signed with sigs 15 | 16 | * We need to check if the money in a 2 of 2 address on the blockchain has moved. We need to be able to tell how much of the money went to each of two users. 17 | * history : (address1, address2, etc) -> outputs to those addresses 18 | 19 | * We need the ability to count up all the coins every sent to an address. 20 | * history : (address1, address2, etc) -> outputs to those addresses 21 | 22 | * given an address, we need to know it's balance. 23 | * unspent : (address1, address2, etc) -> unspent outputs to those addresses 24 | -------------------------------------------------------------------------------- /big_picture.md: -------------------------------------------------------------------------------- 1 | Bob wants to sell Bitcoin. Alice wants to buy. Charlie is running the server used to match Bob to Alice. 2 | 3 | Alice and Bob used to have their money split into many many addresses. In preperation for this trade, they moved enough money into a single address as they need. 4 | 5 | Bob and Alice use a browsers to communicate to Charlie's server. 6 | 7 | Bob pays a fee in bitcoin to get his trade offer listed on the server. Bob decides a minimum ratio between the amount of coins he is selling, and the safety deposit his partner will have to put up, and the safety deposit he puts up. Bob must have enough coins to cover the sale, and his safety deposit. 8 | 9 | Alice uses a browser to look at Charlie's server, and see the trade that Bob offers. She accepts. 10 | 11 | Charlie possibly takes the trade offer off the server, if we reached the limit Bob wanted to trade, otherwise it is split into 2 trades, one is still an open offer. 12 | 13 | Charlie makes a 2 of 2 multisig address using Alice and Bob's addresses. He makes a transaction that spends some of Alice's coins, the safety deposit, and it spends some of Bob's coins, the ones he wants to sell and another safety deposit. All this money is put into the 2 of 2 multisig. 14 | 15 | Alice and Bob each sign the tx, and give their signatures to Charlie's website. Charlie broadcasts this transaction. 16 | 17 | Then Charlie gives Bob Alice's email, and gives Alice Bob's email so they can communicate for the next steps. 18 | We didn't trade emails until their money is locked in. That way you don't get as much spam. 19 | Charlie makes a transaction that gives Alice her safety deposit back, and gives Bob his safety deposit back, and gives the coins Bob wanted to sell to Alice to Alice. 20 | 21 | Alice uses a non-cryptocurrency method to pay Bob. 22 | 23 | Alice and Bob sign the transaction they got from Charlie, and give their signatures to the server or broadcast the tx. It is important that Bob does not sign until he gets paid by Alice. This also returns the safety deposits to the correct owners. 24 | 25 | Charlie notices that the money moved in the expected way, and he records a successful trade into Alice and Bob's reputation. 26 | If the money moved in an unexpected way, he records it as a weird trade and includes details in both their reputations. 27 | If the trade never finishes, then eventually record it as lost funds. --------------------------------------------------------------------------------