πŸ’₯crossing boundaries

Utilize multi-chain data

In the previous chapters, we introduced the concept of the Meta layer. As you may have noticed, the data model layer encompasses more than just the Bitcoin network. Indeed, by creating data models for respective chains, any rules or objects created in the Meta layer can be derived from facts on any chain.

Let's first expand our data model into EVM chains. The EVM data model can be described using just two tables: the transaction table and the logs table. They can be described using the following statements.

CREATE TABLE transactions (
  tx_hash VARBINARY,            -- the txn id
  index INTEGER,                -- the position of this input within a transaction
  block_height BIGINT,          -- the block height
  value DECIMAL(38,0),          -- eth value
  from VARBINARY,               -- from address
  to VARBINARY,                 -- to address
  data VARBINARY,               -- input data
  success BOOLEAN               -- is txn successful
) 
CREATE TABLE logs (
  tx_hash VARBINARY,            -- the txn id
  block_number BIGINT,          -- the block height
  contract_address VARBINARY,   -- the contract made this log
  topic0 VARBINARY,             -- contract method name (abi encoded)
  topic1 VARBINARY,             -- indexed field 1
  topic2 VARBINARY,             -- indexed field 2
  topic3 VARBINARY,             -- indexed field 3
  data VARBINARY                -- all event fields value
) 

we can use different schemas to distinguish different chains. The currently supported schemas for the protocol are shown in the table below.

chain
schema

eth

ethereum

bsc

bnb

polygon

polygon

...

The expanded entity model can be seen in the diagram below.

After we setup multi-chain data model, we can now define some cool protocols based on OICP. In the next chapter, we will first define a protocol called MRC-101. This protocol will allow NFTs in the EVM (Ethereum Virtual Machine) to "Transmigration" into the Ordinals ecosystem.

You can temporarily understand "Transmigration" as a concept similar to "cross-chain," although they have significant differences. In the next chapter, I will provide a detailed explanation.

FAQ

  • I feel like OICP is becoming more like Dune. What are the differences between them?

    • good question

      • Firstly, Dune is an aggregator query engine that analyzes data in the blockchain through query statements. On the other hand, OICP aims to create various rules and objects in the Meta layer using SQL as a universal language. In other words, Dune treats the data in a web 2.0 manner, considering them as information, while OICP treats them as entities. These entities exist in the Meta layer and can move along with the movement of inscriptions. This fundamental difference in goals leads to the fact that they are essentially two different things.

      • Secondly, OICP is essentially a set of protocols rather than a product. The purpose of protocols is to establish specifications, while products are the instance of these protocols.

      • Thirdly, although OICP's current data structures bear some resemblance to Dune, it is important to note that their similarities stem from the fact that both are based on abstractions of blockchain data. Furthermore, during the initial stages, OICP was designed to ensure compatibility and streamline its data structures with Dune for the purpose of quick validation. However, as mentioned earlier, Dune's data structures lack key information such as tracking the location of inscriptions. In the future, the OICP protocol will address these limitations and make necessary improvements.

Last updated