Author

Topic: [FBX] A self-contained prediction market in a coin (early work in progress) (Read 1023 times)

sr. member
Activity: 403
Merit: 251
This is about adding a new feature (embedded bet exchange) to a very old coin (Fairbrix).


Source:         https://github.com/wiggi/fairbrix-0.8-coincontrol
win32 binaries: https://mega.co.nz/#!6Q00TJ5Q!PhbhsRrlbJQbt0ZUuxikIXXoEw5MpCaydNVGcIsZRhA


Part 1: The Oracle (half finished and ready for testing, see below):

When it comes to settlement of bets, I think that ideas like "let nodes google automatically" are not that great.
Someone trustworthy is needed to decide the outcome, sign that data and put it in the blockchain
for the node's reading pleasure. The coin holders in their entirety are trustworthy because it's in their self interest.

- The oracle's answers is about the value of ticker symbols like 'BTCUSD', at specific points of time.
  Not about the exact value but always 1 out of 8 predefined answers like "">250", ">200 <=250" etc.
  The purpose is to settle bets, after all.

- Everyone with coins can vote for the oracle's answer (kinda Proof of Stake but no coin age required
  and votes are retractable until a final deadline)

- all data is stored in the blockchain encoded in regular transactions


Part 2: How to store orders for the prediction market (half finished):

- This is done *not* as contracts as described in bitcoin wiki but as balances held by addresses hard coded into the client.
  (i.e. a specific bet like ">75% probability that Bitcoin is worth more than 10000 Ripples on Dec 31, 2014" will have an address assigned to it)

- for a minimalist implementation:
 - quarterly expiration with one rollover month
 - up to 6 markets like the aforementioned BTCUSD
 - 5% minimum price tick
 - 7 order books per currency pair (because there are 8 possible oracle answers)
 - *2 for bid and ask
 - *2 for the rollover month
 these are 3192 addresses. (recycled after 1/2 year)

- Orders can be transmitted by sending coins to these addresses.
  Orders can be canceled by sending coins back to the originating address.
  Every node maintains all order books (and lists of matched and unmatched orders, per address) updated with every block.

- Now here comes the heretical part: the private keys of these addresses will be public.
  Nodes will scan every block before accepting it and reject blocks that try to send coins from special addresses unless
  - it's an unmatched order and coins go back to originating address.
  - it's a winning bet (after expiration) and coins go to originating address of the winner.
  the same way they already reject blocks for insufficient PoW, failed checkpoint tests or generally not following the rules.


Part 3-???, TODO list:

- Command line functions to build lists of unmatched orders and lists of matched orders
  and display the order books (custom time frame for testing)

- Implement cache system, all oracles's answers must be available immediately as they are
  needed to validate transactions and blocks

- Command line functions to trade (buy, sell, find active markets etc)

- Extend voting system to allow everyone (with coins) to list/delist ticker symbols for trading

- Implement custom "time in force" (encoded in least significant digits of satoshi amount) to
  automatically cancel orders, and auto sending of profits (after expiration).

- Allow the voting system to control essential features of the the coin itself


Notes:

- Trading will only work after supermajority of miners use a new - yet unreleased - client version.

- It's a soft fork, old client versions will remain functional.

- No partial fills. This is due to the nature of bitcoin transactions,
  so locked and crossed markets are possible (==arbitrage opportunities for everyone)


*** If you have coins, vote for the oracle's answer: ***

- Vanitygen is required: https://bitcointalksearch.org/topic/vanitygen-vanity-bitcoin-address-generatorminer-v022-25804

- In Fairbrix debug window|console type: "svlistvotings"
Code:
"index" : 2
"maturity date" : "close of Oct 31, 2013"
"vanitygen command" : "vanitygen -X95 fa5nwd"
  make an address using the vanitygen command, import the private key of the address in a wallet,
  no rescan required ("importprivkey
Jump to: