5

I was looking into omni protocol and couldn't quite figure out some things. I'd really appreciate your opinions. I tried to look into all the bitcoin stachexchange answers, but nothing that much related to what I am asking.

At first, I thought that Omni was a whole new blockchain(they forked it from bitcoin), and then added some more code to implement contracts so that assets could be transferred.

At second, I read that omni does write data to bitcoin blockchain itself.

Question 1) why is not the omni a new blockchain at all if they forked it from bitcoin ? we can see that on github.

Question 2) let's assume, it's not a new blockchain - then this means that my second thought is correct. How does it write data to bitcoin blockchain ? I can think of one way: P2SH Scripts, but wanted to make sure.

Question 3) if the omni is not a new blockchain at all, then how does its explorer work ? I guess, their explorer fetches all their related P2SH Scripts from bitcoin itself . right ?

Murch
  • 71,155
  • 33
  • 180
  • 600
Nika Kurashvili
  • 421
  • 2
  • 6

1 Answers1

6

Question 1) why is not the omni a new blockchain at all if they forked it from bitcoin ? we can see that on github.

As Murch said, Omni uses Bitcoin as its immutable database. So Omni is like a separate blockchain, since the contents of Omni transactions embedded in the Bitcoin blockchain are not relevant to Bitcoin nodes. If there's an invalid Omni transaction, then BTC nodes would still accept it.

Omni doesn't have a directly-connecting peer-to-peer network. It relies on data pushes on Bitcoin.

Question 2) let's assume, it's not a new blockchain - then this means that my second thought is correct. How does it write data to bitcoin blockchain ? I can think of one way: P2SH Scripts, but wanted to make sure.

They could use P2SH - I have a website that uses P2SH to embed data in the blockchain, and it works perfectly. However, currently Omni uses bare OP_RETURN scripts. Most likely, they never thought about using P2SH when they first designed it so they might not afford a breaking change (for Omni, not for BTC) introducing P2SH data pushes. P2SH pushes - are actually currently more feasible.

Question 3) if the omni is not a new blockchain at all, then how does its explorer work ? I guess, their explorer fetches all their related P2SH Scripts from bitcoin itself . right ?

Omni has its own software - a fork of Bitcoin Core. They listen to the Bitcoin network and update their blockchain. If they pulled data from P2SH every time, that would be a waste of computing resources.

So every time a new Omni update on Bitcoin occurs, they update their blockchain, then use their blockchain as their data source.

MCCCS
  • 10,097
  • 5
  • 27
  • 55
  • Thanks for answering. The thing I don't understand is the following: Okay, omni is a separate blockchain. it has the smart contract feature or something like this, so we can create assets on it and be able to transfer it. So, when I make a transaction, it goes to omni nodes. Now, what does omni node do ? doesn't it put and store the actual in its own ledger and share it to every other node ? why does it need the bitcoin blockchain at all ? – Nika Kurashvili Jan 12 '21 at 17:25
  • 1
    @NikaKurashvili Your transaction doesn't go to omni nodes. Your transactions is processed by the Bitcoin network. Once it is included in a block, the omni nodes which receive the new block write the new transaction, if it's valid, to their database. This saves Omni from needing to have its own network miners. – MCCCS Jan 12 '21 at 17:49
  • let's say i am a normal user and going to transfer 3 asset from my address to someone else. I make a transaction, it goes to the omni blockchain, which does some stuff on it so that bitcoin nodes would accept it.after bitcoin nodes have this transaction, they include it in a block. I guess,omni listens to the new block so that it can also add this new block to its own database. Am I all correct? It turns out then that omni blockchain seems to have one single database. and the only purpose of it is to modify transactions into OP_RETURN code or something so that it would get accepted by bitcoin – Nika Kurashvili Jan 12 '21 at 18:12
  • 1
    @NikaKurashvili No no, your wallet creates your Omni transaction and adds it to a your new Bitcoin transaction's OP_RETURN (those two transactions are constructed at the same time since the Bitcoin transaction too needs to follow the Omni specification). The Bitcoin nodes receive and Bitcoin miners accept your transaction. Every time a new block is accepted, Omni nodes, who connect to Bitcoin nodes, also receive the block and scan it for Omni transaction. Valid ones are added to their Omni blockchain. – MCCCS Jan 12 '21 at 18:17
  • aha, so basically omni nodes do exist and they store the copy of the ledger too. It's just omni uses bitcoin blockchain so that transaction confirmations, verification of signatures, longest blockchain rule and many more happen on the bitcoin. Omni seems to be just a redirection mechanism and is just a very simplified than the bitcoin. correct ? – Nika Kurashvili Jan 12 '21 at 18:20
  • 1
    @NikaKurashvili Yes, exactly! It's Bitcoin's job to determine the accepted, immutable order of transactions. The rest is handled by Omni, which doesn't have a separate network but they just listen for new Bitcoin blocks. (So yes, 100% of what you said) – MCCCS Jan 12 '21 at 18:22
  • Any idea why they implemented/created OMNI at all ? it seems like it's good to create assets. Ethereum is just there. why use omni at all ? – Nika Kurashvili Jan 12 '21 at 18:23
  • 2
    Because Ethereum didn't exist when Omni was created. – MCCCS Jan 12 '21 at 18:25
  • I have two questions if you don't mind. 1) So, wallet creates bitcoin transaction with OP_RETURN, and passes its own omni data. I think, in order for a user to use OMNI, he first has to be the user of the bitcoin and has some unspent transactions, because when omni wallet creates a btc transaction and sends it, it first needs to be signed by the private key that owns some money on bitcoin network since transactions are costly. agree ? – Nika Kurashvili Jan 12 '21 at 19:06
  • 2) https://gist.github.com/caffeinum/f64a51ce55d5ac9075bb2f5f2f439c0d there is a line - `tx.addOutput(recipient_address, fundValue)`. since we are talking about tokens, why do we actually send btc to the recipient too ? – Nika Kurashvili Jan 12 '21 at 19:06
  • 1
    @NikaKurashvili 1 is correct, that's why Omni Core [shows](https://camo.githubusercontent.com/2244be2f89bf3fb70580a94913276a0d6f0658be0c79bc5b970e2dad9d0904db/687474703a2f2f692e696d6775722e636f6d2f5a3079713675462e706e67) the Bitcoin balance as well. 2 because that's what the specification [requires](https://github.com/OmniLayer/spec/blob/master/OmniSpecification.adoc#711-transfer-coins-simple-send). (And the destination address is called the *reference*). 546 satoshis is used since it's the smallest amount while Bitcoin considers it to be a *standard* transaction and – MCCCS Jan 12 '21 at 19:15
  • 2
    the real transferred token value is in OP_RETURN. Sending very little BTC to the reference allows saving bytes by not also having to add the reference to OP_RETURN. – MCCCS Jan 12 '21 at 19:16