Distributing portions of an asset and identifying where

+1 vote

Hi,

(apologies upfront for the verbosity of this question)

I have created a single asset called AssetX which can be divided up into one hundred pieces i.e.

  • "issue toAnAddress AssetX 1 0.01"

Having created AssetX on NodeA, I decide to make an offer for AssetX from a separate node and address. On NodeB I first ring fence some of AssetB in exchange for AssetX. I do this using a preparelockunspent i.e.

  • "preparelockunspent '{"AssetB":10}"

I then create the offer itself using createrawexchange i.e

 

  • "createrawexchange txid vout '{"AssetX":0.10}'"

using the resulting hex code for the offer I then jump back onto NodeA and accept the offer by performing

 

  • preparelockunspent '{"AssetX":0.10}'
  • appendrawexchange OfferHexCodeVal txid vout '{"AssetB":10}'
  • sendrawtransaction appendedRawExcahngeHexVal

When the balance of NodeA is checked (gettotalbalances) we see that its amount of AssetX has decreased by 10% and its amount of AssetB has increased by 10. The inverse is true for NodeB.

 

What I would like to know is, if there were multiple nodes making offers for AssetX, and the owner of AssetX accepted all of these offers, then is there a way of identifying the addresses to which portions of AssetX have been distributed? I need to build a view of this information so that I can provide something to this effect...

 

AssetX distributed as follows:

NodeB: has 10% of AssetX

NodeC: has 70% of AssetX

NodeD: has 20% of AssetX

 

I understand that this may require stringing a number of MultiChain API calls together and parsing appropriately but as of yet I am unable to identify how best to do this.

 

Thanks in advance.

 

MultiChain details:

"version" : "1.0 alpha 19",

"protocolversion" : 10005,

 

 

asked May 30, 2016 by dylanrathbone

1 Answer

0 votes
Your best bet is to use the open source MultiChain Explorer, which provides a web-based view of the ownership state of all assets:

https://github.com/MultiChain/multichain-explorer
answered May 31, 2016 by MultiChain
Thanks. I'm aware that the explorer can provide this info, although I need a way to query this data pragmatically. Just to confirm other than the explorer there is no API for this as of yet? Looks like I may need to track and build this data through a third party data store...
That's right, unless you explicitly add an address to a node (e.g. via importaddress) MultiChain doesn't specifically track that address's balances for querying via an API. But you should be able to make a good start using any Bitcoin Core-compatible code that does this for bitcoin, and then tweak it for MultiChain's in-output asset metadata.
Cool. Thanks again.
...