New ‘Assetchains’ Version With Fiat Assetchains

Released a new version of assetchains. (github.com/jl777/assetchains)

Make sure to install parallel to komodo so you end up with:

<dir>/komodo/src
<dir>/assetchains/src

It was a bit tricky to get the bitcoin codebase to run multiple coins at once, but I managed to get it to autospawn a new coin based on just the name. Various things are configurable from the commandline, but only the ac_name parameter is actually needed:

./assetchaind -ac_name=USD

From that, it autogenerates a genesis deterministically so all nodes end up with the identical genesis, it also generates different network magics and ports. By convention the rpc port I made one more than the p2p port.

SuperNET/iguana/tests/assetchains spawns 32 fiat assetchains.

after args: +USD port.10078 magic.b6117643 timestamp.1475772963 supply.10
after args: +EUR port.14589 magic.08b9c7e4 timestamp.1475772963 supply.10
after args: +GBP port.10973 magic.e0b0f630 timestamp.1475772963 supply.10
after args: +CAD port.13695 magic.d64ed952 timestamp.1475772963 supply.10
after args: +AUD port.13873 magic.fb64da69 timestamp.1475772963 supply.10
after args: +CZK port.14981 magic.efc70f59 timestamp.1475772963 supply.10
after args: +JPY port.13756 magic.e940ad14 timestamp.1475772963 supply.10
after args: +NZD port.13030 magic.77a0819b timestamp.1475772963 supply.10
after args: +RBL port.9084 magic.ee5ccbe4 timestamp.1475772963 supply.10
after args: +HUF port.12005 magic.1abb80ca timestamp.1475772963 supply.10
after args: +CNY port.13326 magic.32d0a944 timestamp.1475772963 supply.10
after args: +ZAR port.12883 magic.316df4fc timestamp.1475772963 supply.10
after args: +NOK port.9206 magic.d0aa7a1e timestamp.1475772963 supply.10
after args: +IDR port.12170 magic.527a1d90 timestamp.1475772963 supply.10
after args: +THB port.13565 magic.f78672db timestamp.1475772963 supply.10
after args: +KRW port.8690 magic.3d0c88a6 timestamp.1475772963 supply.10
after args: +MXN port.14948 magic.a705b45e timestamp.1475772963 supply.10
after args: +RUB port.13039 magic.0c676275 timestamp.1475772963 supply.10
after args: +SEK port.15315 magic.3ebba2b7 timestamp.1475772963 supply.10
after args: +HRK port.14554 magic.2b4b6ab0 timestamp.1475772963 supply.10
after args: +PLN port.15636 magic.9d555328 timestamp.1475772963 supply.10
after args: +USD port.10078 magic.b6117643 timestamp.1475772963 supply.10
after args: +DKK port.11814 magic.b9513acc timestamp.1475772963 supply.10
after args: +BGN port.11251 magic.6103fdfd timestamp.1475772963 supply.10
after args: +INR port.14099 magic.a895f51a timestamp.1475772963 supply.10
after args: +HKD port.12993 magic.20f4de39 timestamp.1475772963 supply.10
after args: +PHP port.12283 magic.0336ab4f timestamp.1475772963 supply.10
after args: +MYR port.8529 magic.aa1fd950 timestamp.1475772963 supply.10
after args: +TRY port.14335 magic.cdce41ec timestamp.1475772963 supply.10
after args: +ILS port.10934 magic.eda4a70e timestamp.1475772963 supply.10
after args: +SGD port.10431 magic.9c32dda4 timestamp.1475772963 supply.10
after args: +CHF port.10520 magic.e9820337 timestamp.1475772963 supply.10
after args: +RON port.11150 magic.b5fcd485 timestamp.1475772963 supply.10

With 32 blockchains, it would be a lot of empty blocks, so I have it setup to only mine new blocks when there are transactions. You might notice that the supply for each chain is set to just 10, which is $10 USD for the USD assetchain. This is just to have some coins to test, but the idea is that KMD paxdeposit command is used to deposit coins into the fiat chain.

And so that is what I have working now. A KMD paxdeposit command is monitored by the fiat chain and when seen, it will create the corresponding amount of USD coins. But wait! you say, what is the corresponding amount of USD coins? The answer is in the paxprice command, which will show the KMD cost for each USD.

So a paxdeposit calculates the KMD required to match USD, this then is seen by the USD chain, which issues the USD. USD can then be transacted like bitcoin and even the DEX will work with it once I add the fiat chains into iguana.

Then the withdraw from the fiat chain will work with a paxwithdraw command that is already implemented in the assetchaind. There is still a bit more work needed to do on the komodod side (ie. monitor assetchains and process the withdraw, but it will keep on the blockchain) but for now I am finalizing assetchain changes

Also of note is that assetchaind already integrates dPoW with a relatively easy 5 step process as described in main.cpp:

// dPoW integration steps:
// 0. make sure komodo is installed parallel to this project so ../../komodo/src/komodo.h is right
// 1. include komodo.h with KOMODO_SOURCE being the string of coin symbol
// 2. add extra test to ContextualCheckBlockHeader()
// else if ( komodo_checkpoint(&notarized_height,nHeight,hash) < 0 )
// return state.DoS(100, error(“%s: forked chain %d older than last notarized (height %d) vs %d”, __func__,nHeight, notarized_height));
// 3. call komodo_connectblock(pindex,*(CBlock *)&block) at the end of ConnectBlock()
// 4. call komodo_disconnect(pindex,*(CBlock *)&block) at the start of DisconnectBlock()
// 5. Make sure notarized tx are being made by notaries running iguana notary dapp. replace the notaries.h and komodo_notary.h list if using your own notary nodes.

A lot of code is shared between komodo and assetchains as a lot of the dPoW process is very similar, just with different source/dest, and the processing of komodostate is also very similar.

Next I need to update the iguana notary dapp to do the dPoW for the assetchains to complete the third party chain support of dPoW. I figured it would be cool to have 32 meaningful fiat chains to have as the first dPoW chains. Also REVS can be spawned using the identical code. Currently I dont wait for N confirmations, just so we can test things faster, but of course it will be changed to wait for the transactions to be notarized. That way, we can transact fiat chains at BTC security level.

Before we can scale PAX usage up beyond testing amounts, I will need to add some portfolio balancing code, but all this can and will be done after iguana DEX is supporting the KMD and fiat chains, as that gets us quite a lot of nice functionality.

To do:
1. add third party chain support to iguana notary dapp
2. rebase to zcash mainchain release
3. verify election ratification
4. activate 5% APR
5. iguana DEX support of KMD (ZEC) and fiat chains
6. komodod paxwithdraw and portfolio balancing

Only 2, 3, and 4 are strictly required for komodo mainchain release, but I would like to get all 6 done to avoid any hardforks soon after mainchain release


Bitcointalk Topic Entry

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 *

15 + 18 =