Paxprice RPC Added to Komodod

I took advantage of my time off to write a bunch of new code.

iguana notary dapp now generates a pricefeed and the miner puts the pricefeed into the mined tx as an opreturn, about 150 bytes per block.

komodod then uses this data to generate consensus prices for any combination of 32 fiats as of any height:

{ "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD",
"CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK" };


./komodo-cli paxprice eur gbp 37750
{
"base" : "eur",
"rel" : "gbp",
"height" : 37750,
"price" : 0.88864077
}


./komodo-cli paxprice eur gbp 38000
{
"base" : "eur",
"rel" : "gbp",
"height" : 38000,
"price" : 0.88837559
}

There are almost 1000 combinations of 32 currencies, if you count both directions. base is the starting currency, rel is the ending. So with the eur/gbp above, each EUR gets 0.888… GBP

paxprice is the first RPC I added to komodod, but it wont be the last. I will writeup another whitepaper draft about PAX tech as it does get quite involved.


Added a paxprices RPC call. It isnt fancy, just returns numsamples (timestamp, price) pairs starting from the most recent. The notary nodes are now generating pretty consistent pricefeed entries, so there should be plenty of the raw data.

All 1024 price pairs are supported, with an additional 32 against KMD. for now I just hard-coded .0001 BTC as KMD price, but once it starts trading, it will change based on exchange prices.

Another special case is when base and rel are the same, ie usd usd. I use that to denote the currency’s abstract value. However, I had to come up with a sane way to combine the prices of different currencies without creating distortions, or at least minimizing distortions.

What I did was use recent M1 data for all currencies: http://www.tradingeconomics.com/japan/money-supply-m1 and multiple the abstract value in the price feed (will be detailed in PAXpaper). this allows combining different currency prices with some semblance of common denominator. Essentially we get a 32 currency total M1 supply using normalized prices.

Make sure everything fits in 64bit calculations and presto!

The base base value becomes the percentage of the 32 currency M1 supply.

./komodo-cli paxprices usd usd numsamples

{
"base" : "usd",
"rel" : "usd",
"array" : [
{
"t" : 1477322826,
"p" : 10.67656160
},
{
"t" : 1477322769,
"p" : 10.67656960
},
{
"t" : 1477322697,
"p" : 10.67658080
}]
}

The above shows usd at 10.67% of the total M1 supply. Similar to coinmarketcap, I guess this is like a fiat marketcap. Guess which currency is #1?


./komodo-cli paxdeposit RNJmgYaFF5DbnrNUX6pMYz9rcnDKC2tuAc 1 usd
usdkmd.6558498870 basevolume.100000000 baseusd.1000000000 paxvol.100000000 usdvol.100000
0255534400e1f505000000003c8ee61a3161993f4f7b7081259bf5f3322d65d3f8 ht.39430 srcaddr.(RNJmgYaFF5DbnrNUX6pMYz9rcnDKC2tuAc) usd fiatoshis.100000000 -> dest.(RSttHqE7YAooCTb3LjNEnhYwCCTsTb95BH) komodoshis.655849000
f0e1878432ce581fa8547b89e46b377181fa8b61719d70a4653e57d2f6790d02

I figured out how to encode a PAX deposit transaction into a normal bitcoin style transaction. it is a cold address as the pubkey 0255534400e1f505000000003c8ee61a3161993f4f7b7081259bf5f3322d65d3f8 is not published until it is redeemed.

Still fiddling with getting this data into the wallet so it can be used for the redeem. Also, still need to figure out how to submit a redeem.

Keep in mind this is the fundamental low level deposit/redeem based on fiat value from the blockchain. A higher level layer will need to be added to manage the overall balances, so really it is only half done.


Bitcointalk Topic Entries: 1, 2, 3

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × five =