Quarkchain: a closer look into their sharding implementation

in #blockchain7 years ago



Hello again!




qk2.png



A few days ago I worte an article about the basics of Quarkchain. However, in this post I would like to explore more in depth how sharding is going to happen in this project!

There is going to be a little bit of overlapping with my other post, but I did this on purpose because there are some key points that we need to review before moving forward. I hope you like it!

First off, it’s important to remember that Quarkchain consists of two layers of blockchains. Elastic sharding blockchains (shards) are applied as the first layer, and a root blockchain as the second layer (that confirms the blocks from the first layer). The focus of this article is in the sharding layer, which functions as a ledger, updating the ledger state, performing transactions, and recording results.

What kinds of transactions are going to happen in Quarkchain:

In a QuarkChain system, transactions are classified into two categories:

⇨ In-shard transactions, where the input and output addresses of the transaction are in the same shard;

⇨ Cross-shard transactions, where the input and output addresses are in different shards.

In-shard transactions are simple, since a shard already contains complete ledger information of the shard. Cross-shard transactions are more difficult because of the synchronization between two shards. QuarkChain fully supports cross-shard transactions as first-class citizen, in a sense that:

⇨ Any user could issue any cross-shard transaction at any time;

⇨ Cross-shard transactions can be confirmed in minutes;

⇨ The throughput of cross-shard transactions could be scaled linearly as the number of shards increases.

Why Quarkchain's sharding implementation is better?

Unlike other sharding solutions in which a user may need to create multiple accounts in different shards in order to interact with all users/smart contracts in the network, QuarkChain system greatly simplifies account management - a user only needs to have one account to manage all addresses in all shards and is able to interact with all users seamlessly.

In addition, they will create a smart wallet application that will automatically perform cross-shard or in-shard transactions (including smart contract) for a user, and the user may not be even aware of sharding in the system. Some users may choose advanced way to manage their addresses, e.g., allowing payments always via in-shard transactions, and thus a merchandise is able to receive a payment from all users in seconds.

A user may not be even aware of sharding in the system. But how will this work exactly?

Since a user can manage all addresses in all shards via a private key, a user will essentially have the same number of addresses as the number of shards. If the number of shards is large (e.g., thousands or tens of thousands), a user may have multiple balances in multiple shards, and thus managing all balance in all shards can be inconvenient. They further simplify account management by defining the following two types of accounts:

⇨ Primary account: Primary account is the address of the user in a default shard;

⇨ Secondary account: Secondary account manages the rest addresses of the user in the rest shards.

To simplify management, most transactions of a user will be initiated from the primary, temporally move to an address in secondary account if the transaction requires (e.g., smart contract in different shards), and if there is remaining balance in secondary account after the transaction, the balance will be moved back to the primary account. This ensures that the balance of the user should be in the primary account most of time, and thus the user does not need to manage the balances in the addresses of secondary account.

Will Quarkchain be able to perform cross-chain transactions?

With their design architecture, cross-chain transaction becomes approachable. Since they only maintain one root chain, the transaction from another blockchain can be implemented by converting the tokens by an adapter and then performing the transaction like a cross-shard transaction from QuarkChain’s side. Another way is to accommodate the other chain as a subchain (or shard) so that cross-chain becomes cross-shard transaction.

To support off-chain transactions is going to be very important in the future to where blockchain ecosystem is heading to. Some applications need both on-chain and off-chain handling. For example, some transactions need to access external data (not on the blockchain). The QuarkChain two-layer sharding structure makes this on-chain and off-chain handling very flexible. This opens more opportunities and applications.

Quarkchain’s sharding and AI:

Finally, I would like to end this article by sharing this very interesting idea I read in Quarkchain's whitepaper, regarding sharding and AI:

There are many aspects of AI that can be used in blockchain technology. For example, through reinforcement learning, sharding can be more efficient so that the common trading clients can be allocated in one shard or at least closer shards to reduce the transaction cost. This requires that the blockchain design has the reshardable ability, and Quarkchain offers this function exactly!

qks.jpg

Thank you for reading! Stay tuned for more articles about ICOs and cryptocurrencies in general! Please like and subscribe!

Sort:  

Thank you for another helpful post, sir!

Congratulations @cesar1234p! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update
SteemitBoard to support the german speaking community meetups
Vote for @Steemitboard as a witness to get one more award and increased upvotes!