Issue asset in the transaction

+1 vote
Issue asset in the transaction

I want to issue assets in some transaction,
for example:
Buyer A, Seller B
B sell an asset (call "beef") to A, but B don't have "goods" in chain.(but B have "beef" in real world)
A want to buy this "goods" from B by an asset (call "pork"), but A also don't have any "pork" in chain. (but A have "pork" in real world)

So A and B exchange "pork" and "beef" in realworld, and they issue "pork" and "beef" in chain to exchange.

How can I do that?
I know that is risk for the blockchain, but this is my academic testing.
asked Aug 15, 2017 by woei

1 Answer

+1 vote
Best answer

You would have to create an address with 'getnewaddress' for each party then use 'issue' or 'issuefrom' to create an asset and assign it a value. This is to put both parties into the blockchain and create the assets 'pork' and 'beef' with initial values.

To do the actual exchange you would use 'send' or 'sendfrom' to send the asset from the one party to the other party.

See @ for more information on what the API is expecting.

answered Aug 16, 2017 by RobertJ
selected Aug 16, 2017 by woei
thanks! I got it!
You can perform the exchange in a single atomic operation, rather than two separate sends, using the exchange APIs. Tutorial here:
So, I must be issue assets for each party, then exchange that two assets, not send asset for each party.