QuarkChain Code Review - Deep Dive
analysis

QuarkChain Code Review - Deep Dive

THELOGICALINDIAN - n-a

Today I’m accomplishing a abysmal dive with my QuarkChain cipher assay – the allegation actuality were factored into the QuarkChain ICO review that we aloof appear yesterday. We’ll be accomplishing this added and more, to accord you added of a faculty of why our ICO reviews are rated the way they are, back the cipher assay is an important metric in our analysis.

QuarkChain, the aerial capacity, peer-to-peer, transactional system. Buzzwords for blockchain, but we won’t authority that adjoin them. Promising 1 actor TPS… So, if any of you accept apprehend any of my antecedent work, you apperceive how I feel about 1 actor TPS. I aloof don’t accept the attraction and added so I don’t accept this ambition number.

Can we all, as a community, amuse booty a footfall aback and attending at our accepted ecosystem. Right now our accomplished assembly blockchains are maxing out at about 2k TPS, so can we amuse accomplish our ambition a assembly akin 10k TPS? And again can we focus on 50k TPS?

We still accept a lot of targets to ability afore 1m TPS, you apperceive what I appetite to see? I appetite to see the 13,431 TPS blockchain promise. I appetite to go on a website, and see “we can accomplish 13,431 TPS” that I’ll believe. If you acquaint me you do 1 actor TPS, I automatically banderole you as a scam.

That out of the way let’s attending at some of the tech.

Two-layered blockchains, adaptable sharding blockchains (shards) in band one and a basis alternation in band two. Consider Ethereum is the basis chain, you accept a lot of Ethereum ancillary chains, we accept POA, we accept dAppChains (from Loom Network), anniversary of these ancillary chains is abiding in Ethereum. This is a abecedarian account of this two layered approach.

Right now Ethereum uses their ERC20 badge (this gives us tokens such as EOS, TRX, etc), now instead of Ethereum accepting had anniversary one as an ERC20 token, instead they had anniversary one as a ancillary chain. This starts giving you an abstraction of adaptable sharding blockchains, a new badge gets added we add a new blockchain, but anniversary one is still accepted aural the Ethereum mainchain.

So accumulate the picture, of lots of ancillary chains all abiding in Ethereum mainchain, in apperception back we allocution about the two layered approach.

The blow are absolutely all appearance off of the two-layered blockchain, we will jump into anniversary abstraction as we go through them in the cipher review, the one that deserves acknowledgment about is Cross-shard transactions.

In my quick Two-layered blockchain archetype above, we batten of ancillary chains for archetype POA and Loom Networks dAppChain, the botheration about is that these two can’t natively acquaint with one another. Not unless you apparatus some anatomy of a cross-chain bridge. In QuarkChain these are advised as aboriginal chic citizens.

Basically we are adage they are inherently allotment of the system, the aberration amid sending an on-chain transaction against a cantankerous atom alternation transaction is as accessible as alteration the destination address.

So with these two aerial akin concepts in mind, let’s attending at the code.

So, we alpha of with pyquarkchain, my actual assumption, they aloof cloned pyethereum. I apperceive I shouldn’t be so pessimistic, but with the arduous bulk of projects I accept looked at, cloning seems to be the norm.

And what a affable surprise. I alike approved digging into a few files that I was abiding would accept been copies, all custom. We do accept a few imports for EVM and P2P from Ethereum, but these are aloof raw imports.

Some stats on the repo, 268 commits, 4 branches, 4 contributors. I like the contributor ratio, branches administration is used, commits while baby accommodate a lot of substance. Off to a acceptable start.

Pull requests and affair administration is absolutely actuality used. Good to see.

Quick allegory of the two cipher bases (pyquarkchain & pyethereum).

Good comments. Let’s jump into some of the absolute functionality.

Testnet is currently active on 8 shards (this is configurable). Chains are mining in Proof-of-Work. Each alone atom is active amid 100–200 TPS, all-embracing TPS currently at about 1.1k.

So, we charge to get these guys a designer, I admired bootstrap aback in 2024 back it came out, but we charge to get these guys assimilate material. Wallet is beeline forward, I accept my accepted catch and animadversion about it not actuality HTTPS, a affidavit takes 10 minutes, appear on guys.

Wallet uses ethereumjs-util.

We see some getNodes and selectNode functions, let’s accept a look.

They are protected, so assumption no breaking for us today.

Let’s babble about some of the functionality. So bethink beforehand back we declared the sidechains, that’s a anatomy of abandoned sharding, agreeable the accomplished into abate parts. I don’t absolutely appetite to alarm what QuarkChain is accomplishing sharding, the absorbing affair actuality is one of their appearance they mentioned beforehand Simple annual management. Let me copy.

“There is alone one annual bare for all shards. All cryptocurrencies from altered shards are stored in one acute wallet”, the affair about a agglomeration of Ethereum clones (WanChain, POA, dAppChains, etc) is that they all allotment the aforementioned private/public key architecture. This agency if you own a private/public key brace on Ethereum, you additionally own that aforementioned private/public key brace on WanChain, POA, and every added clone.

So in the Two-layered archetype we mentioned above, you would own this key in anniversary ancillary alternation as well. But this would account conflicts? Since now, how do I accelerate my 10 WAN to my POA address? Well, you can’t. In QuarkChain you can? So how does that work?

So first, we charge to attending at why our (my) aboriginal acceptance on the ancillary alternation two-layered architectonics was wrong. We can alarm that access namespace sharding (each sidechain/token would accept its own name).

What QuarkChain does is actualize a affectionate of alongside sharding. So clashing the sidechain example, this is added like alongside Ethereums all active abutting to anniversary other. If Ethereum A starts accepting busy, you move your funds to Ethereum B. For this acumen I attempt to alarm it accurate sharding, back anniversary atom is absolutely not a allotment of the whole, but a archetype of the whole, all active concurrently, yet isolated.

So back I own a key, I own that key in Ethereum A, Ethereum B, Ethereum C and so forth, and I can move my funds amid any one of these, but won’t that account a battle again? So your accessible key has the accession of which atom it is in, so it can be apparent as key atom ID, so if you own abject abode 0x1, you accept 0x1a, 0x1b, 0x1c and so on. So back you appetite to move your funds from 0x1a to 0x1b you artlessly use the abode you appetite to accelerate to. This is how they acquiesce distinct key buying while advancement cantankerous atom interaction.

Here though, the two alongside chains can’t ability consensus, so they charge to await on the root-chain for their consensus, so the basis chain’s primary action are these cantankerous alternation transactions. Where in a accustomed Ethereum transaction you accept abode A sending to abode B, now you accept blockchain A sending to blockchain B, aforementioned concept, but the from and to parties in catechism are of a altered scale.

So back these are alongside chains, what happens if anybody artlessly transactss on Ethereum A, and no one uses Ethereum B or C? Well, again Ethereum A becomes chock-full and it will alpha adversity throughput. This will account fees to go up, so now, if you capital to accept a bargain transaction, you could artlessly action your transaction on Ethereum B, and if both A and B accept an according amount share, again you could move to C.

This abstraction is the bazaar apprenticed collaborative mining, acknowledgment to the accolade anatomy the amount is aggregate beyond the shards. The botheration though, you accept all your funds in Ethereum A and you appetite to now participate to the ICO on Ethereum C, but A is chock-full and you accept to pay aerial fees to accomplish your alteration from A to C, and not alone do you accept to pay the aerial fees, but you accept to delay for the basis alternation to agree your transactions, abacus added overhead.

I’m not abiding how they will accouterment this problem, but I see it as an issue. Also the micromanagement that users accept to do amid their own shards will actualize a bad user experience. I anticipate these are 2 key issues that charge solving. 

So already we see the applied TPS is less, because the bottleneck can action on one alongside alternation and we accept to accede the aerial of the basis chain.

So, let’s attending at the abstract ancillary of the TPS first.

Current shards are active at, let’s go with 150 TPS, so 1m/150 agency 6667 shards required, sharding supports up to 2 billion shards. So, apparently sure, are you activity to micromanage 6667 shards by affective your funds around? So let’s about go with about 10 shards for about 1.5k TPS.

Next up is CPU, I’ve managed about 5k TPS on a distinct amount (dedicated alone to TPS), so let’s say about 1k. If we attending at some of the monster machines in AWS, m5.24xlarge, let’s say 72 cores, so 72k TPS (assuming there were abundant affairs to be done in alongside and you didn’t accept to do them synchronous, remember, the acumen we do affairs ancillary is because transaction 0x2 ability be afflicted by transaction 0x1. If I accept 10 QKC and I accelerate 10 to A and 10 to B and they are candy in parallel, both could succeed, so we accept to action them synchronous. But let’s accept we accept 72 shards so we can run anniversary atom on a CPU, so let’s say 72k TPS is possible.

We said about we will attending at about 10 shards, so let’s instead say 10k TPS is accessible (highly possible)

Even at 20 shards, which is still reasonable, we bound alpha attractive at 20k TPS. I’m still actual abundant adjoin the 1 actor TPS claim, but these guys are attractive realistically abutting to a abeyant 10–50k TPS system.

And now we haven’t alike started talking about absorption yet, which I anticipate I will leave for addition commodity back at this point you charge be bored.

QuarkChain Code Review Conclusion

If you fabricated it this far, congratulations, this is apparently the best I accept accounting on any ICO so far, and why? Because they accept added actuality than any ICO I accept accounting about, there are things I disagree with, but I am candidly impressed. I anticipate they should bandy abroad the 1 actor TPS affirmation and aloof say 50k TPS, and I absolutely anticipate they accept a astute attempt at it (and we charge to get them a UI/UX expert)

I anticipate their accomplishing is novel, able-bodied executed, and I am absolutely activity to be arena about a lot added in their testnet. It annoys me that I haven’t been able to breach it yet.

Full QuarkChain ICO Review is here.

Disclaimer: Crypto Briefing cipher reviews are performed by auditing what is on affectation in the adept annex of the repo’s fabricated available. This was performed as an educational analysis and any comments in the commodity are the assessment of the writer. It is accustomed for cipher to change rapidly, appropriately we timestamp our cipher reviews so that they present a snapshot at a moment in time. Information independent herein should not be acclimated as any animadversion or admonition on the activity as a whole.

QuarkChain Code Review Timestamp: April 16th, 2024 at 17:42 GMT