OmniLayer / omnicore

OmniCore staging tree
http://www.omnilayer.org/
MIT License
756 stars 228 forks source link

Query related to Building Raw transaction #664

Open enVolt opened 6 years ago

enVolt commented 6 years ago

I'm following this tutorial (from Wiki section of this repo)

I've following questions -

  1. As mentioned in another wiki article (here), Source of the transaction is considered as 1st Input. Let's say I transfer X coin to an address (A). A new utxo is created. Now A has sent Y coin (Y < X) to another address B. After this A will not have any Utxo, how can A spend the remaining (X - Y) coin at this point?
  2. Do I need to provide specifically an input with tx referencing Omni tx, or any valid Utxo will work, which is an utxo for Source Address for new transaction that I'm building.
  3. The construct payload part (this), how can it be done without using omnicore? JS library of bitcoin provides a method to add OP_RETURN output (bitcore, bitcoin-js). Can I do the omni_createpayload_simplesend conversion in Js (probably converting string to a buffer and feeding it to the bitcore/bitcoinjs lib.
dexX7 commented 6 years ago

Hi @enVolt,

  1. A needs a fresh UTXO. Either via a new transaction, which funds A explicitly, or as alternative: maybe during the first transaction, there could be some BTC sent back to A to avoid the case in the first place?

  2. Balances on the Omni Layer are associated with scripts/addresses and any UTXO will work, as long. The first transaction input is used to determine the token sender.

  3. Omni Layer payload outputs have the following structure:

OP_RETURN 0x6f6d6e69[actual payload]

0x6f6d6e69 serves as marker.

To construct the payloads manually, you can use the following tool to play around:

http://builder.bitwatch.co/

dexX7 commented 6 years ago

Consolidate like "send tokens from many different sources in one transaction"? This is currently not supported.