Sidechains — Scaling in Neurai

NeurAI Project
6 min readNov 16, 2024

--

One of the major difficulties that any blockchain project encounters is the ability to scale and achieve a balance between the resources needed to operate a node, without going to the extreme of using high-capacity equipment that is expensive and not very accessible.

Account model vs UTXO model

[1] UTXO vs ACCOUNT

When Vitalik and his colleagues created Ethereum, they made a significant change in how address balances are reviewed, making it more similar to a database since everything assigned to a public address is accounted for. This allows developers not to need each of the UTXOs of an address, saving on the necessary space when moving coins/tokens and creating a more flexible system for executing transactions. However, everything has its problems, such as the account usage being locked when it is in use, for example, when sending a token.

The important part lost in this process is the parallelization that exists in UTXO models, where it is possible to send each one independently and even, in some cases, perform several transactions without them having been assigned to a block.

UTXO model

At Neurai, we have chosen the UTXO model due to its parallelization capabilities, as well as the use of PoW for network consensus to ensure its security.

This model has difficulties in optimizing the use of information to perform massive transactions, as it requires all the information of the UTXOs that are going to be moved.

[2] UTXO MODEL

In the image, you can see that for TX6 it is necessary to include TX4 and TX5, which increases the required space for the block. This is more complicated to manage when an exchange receives from multiple clients, making their transactions very large.

Options to scale

There are several methods that are not perfect but can serve this purpose depending on the needs of a blockchain

  • Increase in block size: Increasing the block size allows more transactions to be stored, which would enable indefinite scaling based on size. The problem with this method is that large blocks require powerful equipment to process, and in a UTXO model, this could make the blockchain very difficult to manage in just a few years.
  • Reduction of block time: Similar to increasing size, although there is a limit for UTXO models that operate with PoW, where it will always be necessary to have at least an average block time of about 20 seconds to avoid orphan block issues.
  • Sidechains: Sidechains allow for a blockchain parallel to the main one with different operating options, such as a PoS model, different block times, specific smart contracts, etc. It wouldn’t have the guarantee of the main blockchain but would serve specific purposes.

The important part that is often forgotten is that scaling is contrary to security. A decentralized model has redundancy to guarantee the information, but this comes at the cost of using resources inefficiently.

Considering the previous models, for Neurai we are going to implement an intermediate model between increasing block size/speed along with a sidechain.

Sidechains

To understand this new concept, it is necessary to understand how a sidechain operates in a UTXO model like ours.

[3] Sidechain

A sidechain is a lateral chain that is anchored to the main chain, allowing operations between both chains. This makes it possible to send coins from the main chain to the sidechain through locks performed by a smart contract between both parties.

In our model, the functionality is to coexist within the main chain while being outside of it at the same time.

Sidechains in Neurai

At Neurai, we have devised a model that is simple to implement and allows for global scaling, but also individual scaling. The current model in Neurai consists of having the hash of a file — be it a photo or document — and a link to its IPFS destination.

In these new models, there will be various types of nodes managing the network:

  • MAIN Nodes: These are the primary nodes used by miners or anyone who wants to make general use of the network. These nodes will only have the file’s hash information, the sidechain ID, and its associated token if it has one.
  • Public Sidechains: These nodes have all the information from the MAIN nodes, but in addition to the hash, they also contain the actual file that generated the hash. By adding a parameter in neurai.conf, you can configure which chain to use. Depending on the chain, these files—verified by the hash from the MAIN chain—will be downloaded to confirm their authenticity. Anyone can access them, but their information will only be transmitted through nodes with this label.
  • Private Sidechains: Similar to the public sidechains, but with the difference that not everyone can access these chains or the file data, even if they have the label information to configure the node. They can be linked to a token that grants permission for access.

One of the reasons why we think this model is good for Neurai is because:

  • Scaling without damaging the main chain.
  • There must always be a node running with the original data of the sidechain, similar to how a torrent shares a file.
  • Customizing nodes for particular uses, corporations, and communities that can access a reliable information distribution system over time, in addition to being controllable through the assignment of specific tokens.
  • The private model will allow compliance with current EU legislation that requires the deletion of information on a blockchain in case of a judicial request. These private models permit the deletion of files and tagging them so that the node does not verify them because they are not present, and only the HASH is counted.

Sidechain for RWA

By being able to control these private sidechains, it is possible to modify them to adapt to certain necessary characteristics. A company may need a blockchain that consumes few resources and is redundant for asset tokenization.

The community will not be the only one able to utilize tokenization through a sidechain model; it opens up the possibility for entities to freely use a public blockchain to have a private blockchain, expanding the chain’s multiple potential uses.

[4] Assets in Neurai

How it will be configured

Before making these modifications, we need to conduct tests on the testnet. But even before starting this process, it will be necessary to modify the block time to reduce it to about 20–30 seconds, expand the OP_Return space to accommodate more information for the asset tree, and add certain OP_Codes that can be used for Smart Contracts in the future.

The configuration will be through the compiled node itself — Linux, Windows, or Mac — along with a customized setup in the neurai.conf file. Something similar to the following:

rpcuser=UserRandom
rpcpassword=PassRandom
server=1
listen=1
txindex=1
assetindex=1
addressindex=1
timestampindex=1
spentindex=1
listen=1

#Sidechain Config
sidechain=1
sidechainname="RWAGlobal"
sidechainspace=1

Finalizing

This development will take time, as our devs will need to conduct multiple tests before adding it to the main chain. However, we believe it will be an essential component to make Neurai’s blockchain usage self-sustaining in the future. High usage of the chain will help ensure its security over time.

It will also be incorporated into the whitepaper, detailing its functionality and potential uses along with the other elements included in the project: IoT, RWA, DePIN, and AI.

LINKS

[1] https://speakerdeck.com/line_devday2021/how-do-we-secure-transaction-data-in-account-base-blockchain?slide=23

[2] https://revo.network/technology/utxo-and-account-balance-models

[3] https://crypto.com/university/what-are-sidechains-scaling-blockchain

[4] https://neuraiproject.medium.com/assets-in-neurai-a24c87db586d

--

--

NeurAI Project
NeurAI Project

Written by NeurAI Project

Neurai is a Layer-1 blockchain with ASIC resistant and NFT/FT onchain focused on IoT and AI.

No responses yet