I want to propose an issue mode that assigns asset units automatically to addresses which paid coins to a specific address.
In other words: if an address paid one coin to address A, this address should receive one unit of asset X.
It’s a bit similar to this proposal: Smart Property Example?, and yes, it would need some code changes, particularly a new issue mode.
I have looked at the PeerAsset code (still superficially) and I have already an idea how this could be implemented.
The idea would work the following way:
- The creator of the asset X issues a deck and specifies the address where payments must be sent to receive assets (in the variable deck.asset_specific_data).
- If you made a payment to address A, you can create a CardIssue transaction of asset X, referencing the output O you spent to address A (txid + output number) in card.asset_specific_data. The amount of X created must be equal to the amount paid to A.
—> this would require a change in the CardTransfer class, because in this case, the deck issuer is not the coin issuer like it is required until now.
- The parser (it could be a custom issue mode) checks two things for each of the CardIssue transactions of asset X:
– First, if the transaction to A with output O referenced really occurred on the blockchain and was confirmed (confirmation requirements can be determined),
– Second, only the first CardIssue transaction referencing a specific output O is valid (the rest are considered bogus).
From my Python knowledge and the code I looked at, I think this concept should be possible with PeerASsets, but I have a worry: that this parser could be very CPU/memory intensive, as the validity check for a CoinIssue transaction is much more extensive than a simple check “cards really were issued by deck issuer” like in “standard” PeerAssets, and it seems to require several for loops.
Wanted to ask if there were already ideas for such an issue mode in the PeerAssets developer community?
I think this kind of asset would be very useful for a kind of “trustless ICO contract”, where the assignation of the assets occurs automatically, and the participants do not have to trust the deck issuer to really transfer the coins.