ChluNetwork / chlu-ipfs-support

Support libs to talk to IPFS
MIT License
1 stars 1 forks source link

Multiplex payments to multiple vendors in the same transaction #88

Open kulpreet opened 6 years ago

kulpreet commented 6 years ago

The idea is to map vouts to the review record index. We can discuss this later when you are about to implement it.

fazo96 commented 6 years ago

Here's how I would do it

When sending the transaction

Instead of putting the RR multihash, we include the cid of a multiplexer data structure that is an array of mappings voutIndex: RRMultihash. Maybe put a chlu_version field in there as well.

When reading from the blockchain or validating

The getTransactionInfo function in the bitcoin module is called from the validator module. It now returns the multihash of the associated review record and an outputs array with { index, amount, toAddress } data structure. I can just change it so that it puts the multihash in the items of the outputs array and the validator gets it from there. The demultiplexing work will be done in the bitcoin module. If it fails, it will just put isChlu: false in the transaction (it already does if there is no multihash in the OP_RETURN)