Nexo

We’re Giving out 10 BTC in Rewards until the Bitcoin Halving

Learn More

Chainspace Code Review: Sharded Smart Contracts

Chainspace Code Review - Sharded Smart Contracts - Review By Andre Cronje For Crypto Briefing

Share this article

Chainspace is a platform for creating a distributed web of blockchains that – like many before it – seeks to create the Ultimate Answer To Life, The Universe, And Everything. (Or, as we refer to it in crypto, Scalability, Speed, and Security.) In my code review I point out that it might even work.

I have to admit, I’m excited. I loved their paper, I love their published work, I really admire the team. I’m very excited that I got my hands on the code.

“Sharded smart contracts, decentralized infrastructure on a planetary scale. A distributed web of blockchains for scalability, speed and privacy.”

  • High throughput and low latency via a fast, two-phase Sharded Byzantine Atomic Commit protocol (S-BAC)
  • Uses a wide range of developer languages to gain adoption beyond the current blockchain niche
  • Focus on the developer experience to help developer adoption and collaboration
  • Integrated design thinking and user-centred design from the ground up, ensuring we build the most usable platform for developers, organisations, and end users.”

No mention of a token, no TPS, no bold claims, just pure developer focus.

Ok, they did say Linear scalability. Fine, I’ll subtract some points. Anyway, let’s jump in. I have no idea what we are even looking at, is this BlockMania or S-BAC, I have no idea.

There is a lot going on, let’s start from the makefile, see what is built, and trace from there.

Usual suspect, ./cmd/chainspace/

So many toys, block graph interpreter, node, transactor, manage chainspace contracts, let’s start with node.

“Prototytpe” but it has a lot of usability features, error checking and logs. This is going to be annoyingly good, let’s hope I’m wrong.

Broadcast service, top, transactor all look interesting.

Connections from broadcast and transactor, interesting, is this a jumping push-pull model? I didn’t see anything about that in the BlockMania paper.

Topology map, definitely need to look into this more. Network graphs are fantastic for broadcast based systems, but they give quite a bit of drop in / drop out overhead in permissionless networks.

Just fantastic code so far.

Contacts, nodes, shardCount and size. I need more data. Built in network shards in the topology already.

Using badger for key value storage, my current favorite.

Super elegant code, great architecture and structure.

Image and containers for contracts? Everything is executed in docker images. So no self hosted VM, that’s how they can keep the UTXO model for BlockMania. Smart.

The BlockDAG, already sharded and built in quorums. Let’s look for the broadcast and voting schemes.

So yeah, all of this is frustratingly good. I won’t be surprised if they already have a testnet running.

These guys are rockstars.


Chainspace Code Review Conclusion:

I’m going to keep going through this, but it’s amazing. Probably the best I have seen yet. It’s elegant, it’s simplistic, and it has had a lot of hard work that has gone into it. By the way, it was S-BAC and BlockMania.

You can chat about Chainspace in our Telegram group.

Disclaimer: Crypto Briefing code reviews are performed by auditing what is on display in the master branch of the repo’s made available. This was performed as an educational review and any comments in the article are the opinion of the writer. It is normal for code to change rapidly, hence we timestamp our code reviews so that they present a snapshot at a moment in time. Information contained herein should not be used as any comment or advice on the project as a whole.

Chainspace Code Review Timestamp: October 21st, 2018

Share this article

Loading...