— Codename: Mao Shan Wang
We launched Testnet v2 back in June this year, which came with critical features, including documentation and the Scilla IDE, that enabled developers to write and test their smart contracts on our platform.
Today, we are thrilled to announce that Testnet v3, codenamed “Mao Shan Wang” after another one of our favorite durian breeds, is now live. This is a major technical milestone — as far as we know, this is the first fully-fledged testnet in the world to implement network, transaction, and smart contract sharding. This specific testnet has addressed some of the security issues discovered by our security auditors, and added required safety checks and extra enforcement mechanisms to improve the stability of the system.
Mao Shan Wang contains the same set of features as the upcoming mainnet. This includes the full-scale implementation of Scilla (our safe-by-design smart contract language) across the network, the implementation of our solution to smart contract sharding, and the public mining of testnet ZILs. It enables larger-scale public testing of the key features of our upcoming mainnet and is a key step for us towards launching mainnet on Jan 31, 2019 (roadmap here).
We will release the full details and documentation around public mining on Monday, Dec 3, to provide more timely technical support and bug-fixing for our miners.
For our non-durian connoisseur community members, you can learn more about the difference between Mao Shan Wang, Red Prawn (our Testnet v1.0 codename), and D24 (our Testnet v2.0 codename) durians here.
Why is Mao Shan Wang significant?
- Technical milestone as the first fully-fledged testnet (in the world, as far as we know) to implement network sharding, transaction sharding, and smart contract sharding.
- Opens Zilliqa’s far more eco-friendly and cost-effective version of mining up to the public for testing, whereby GPUs are only running at full load for a small fraction of time as Proof of Work is only used to establish identities.
- Full-scale implementation of Scilla across the network, whereby new nodes can now also execute contracts. (In the past testnet, Scilla was only implemented on a small set of 20–40 nodes for developer testing.)
- New incentive mechanism that rewards nodes (miners) by taking into account their contributions to the consensus protocol, e.g. by counting the number of times they signed in the past few epochs.
- New upgrading protocol makes it easy and seamless for nodes to upgrade to the latest version.
Mining on Mao Shan Wang
As mentioned above, we will release the public mining guide on how to join the Mao Shan Wang public testnet on Monday (Dec 3, 2018).
The recommended specifications required to run a node on this public testnet are:
- Ubuntu 16.04.5 64-bit OS
- Intel i5 processor or later
- 8GB DRR3 RAM or higher
- Optional: GPU cards (e.g 1 x GTX 1060 with 3GB vRAM)
- NAT environment with UPnP feature supported on your router (Most recent routers should have this feature) or a public IP address
Key New Features
If you have been following our bi-weekly project updates, you may find many of the new features of Mao Shan Wang familiar. These are the features we have been working on for the past few months, and we are excited to now make these publicly available for miners and developers to test.
- Support for smart contracts on a sharded architecture
- GPU mining
- Coinbase rewards
- Gas rewards
- Gas pricer
- Difficulty adjustment of PoW
- Upgrading protocol
- Gossip protocol
- Multiple-In, Multiple-Out (MIMO) DS committee
- Event/Log transaction receipt
- Merged PoWs: Combining the two rounds of PoW into one round
- Node recovery
- State delta forwarding
- Migration to Kubernetes
- Archival nodes
- Type checker
- Static analysers and checkers suite
- APIs to add new passes and analyses
- Gas accounting
- Improved map accesses
- Support for events
Further Technical Details
GPU Selection for PoW Mining: Mao Shan Wang supports GPU mining. Miners may use one or multiple GPU units for one node. For example, a miner with 6 available GPUs can choose to configure one Zilliqa node to employ any combination of the 6 GPUs, or launch multiple Zilliqa nodes with each node assigned to one specific GPU.
Coinbase Rewards: In this implementation of our testnet, we will reward all the nodes (or miners) — including DS and shard nodes — based on their involvement in the consensus protocol. Specifically, the more actively a node participates in the consensus protocol through signing blocks in a transaction epoch, the more it will be rewarded with tokens. For instance, for a microblock/finalblock, a node can contribute up to two signatures, and can thus be rewarded twice.
Gas Rewards: Another feature essential to a public blockchain is the distribution of rewards to miners from gas fees. In the version, gas fees generated by processing transactions are accumulated into the total coinbase rewards. The rewards are then issued just before the next round of PoW submissions begins.
Gas Pricer: While our transactions are already processed with gas consumption and limits are taken into consideration, the mechanism for determining actual gas pricing had yet to be implemented until recently. Our newly-coded gas pricer works by first, having miners affix to their proof-of-work (PoW) submissions a minimum gas price that they are willing to accept. The Directory Service (DS) committee then reaches consensus over the acceptable global minimum gas price for the network in the coming DS epoch. The network will thereafter only accept transactions that have a gas price larger than or equal to the agreed-upon global minimum.
Support for Smart Contracts on a Sharded Architecture: A few months ago, we released a blog post that details our design to support smart contract sharding. In the design, we leverage the DS committee to process certain types of smart contract transactions. As a result, the DS committee now runs an additional consensus round to validate those transactions. This happens after the DS committee has received data on transactions validated by shards.
Upgrading Protocol: It is crucial that a system can be upgrade or updated with new features or patches to ensure its security. We’ve implemented the first version of our upgrading protocol. A source (say https://latest-release.zilliqa.com) hosts the latest version of our source code and binary with SHA-256 value, signed by multi parties, e.g., Zilliqa Research. The software version will be stored in a separated file named VERSION, with the information of version, expected DS epoch and SHA-256 value.
Node Recovery: Node recovery is one of the more significant features that we have completed in the past few weeks. If a node was terminated for any reason (such as to complete an upgrade) and then relaunched, it will read the persistent data stored in the machine’s database (data such as the DS committee members, the sharding structure, DS and Final Blocks, etc.) in a bid to recover its last known state and to begin resynchronizing with the rest of the network.
Type Checker and Static Analyzer Suite: Scilla now includes a suite of static analyzers and checkers. The goal of these checkers is to aid developers in writing contracts that pass some basic to advanced safety checks. For instance, Scilla comes with a type-checker that checks contracts for type-safety. Type-safe programs are known to eliminate several issues that may appear at runtime. Another checker (and part of the suite) checks for well-coded pattern matches. Given a contract, it checks whether every use of pattern matching covers all possible branches and hence is exhaustive. It also checks for unreachable patterns. A non-exhaustive pattern match may lead to errors at runtime when an input leads to a branch that is unhandled. These checkers will be run by each miner at the deployment time and hence some basic yet powerful safety guarantees on contracts deployed on Zilliqa’s blockchain can be provided.
More advanced static analyzers such as the cashflow analyzer and the gas analyzer will also be available for end users or clients such as the IDE. These checkers, however, will not be run by miners. More on these analyzers can be found in our previous bi-weekly updates.
In fact, it is also possible to add any other static analyzer to the suite using our APIs. You can join us on Github to play around with the Scilla codebase and add your own checks. Some desired checks that will be good to have are: 1) Unused variables 2) No integer overflows 3) At least one transition accepts payment.
Gas Accounting: In the previous release, smart contract processing entailed a constant gas cost irrespective of the nature of the computation involved. The new release comes with a proper gas accounting where each expression, statement, reading and writing from/to storage etc., comes with a well-defined cost. A document that lists the gas consumed for each operation is available here. Note: Gas costs are subject to changes.
Support for Events: Scilla contracts will be able to emit events that clients can listen to. Support for events required adding new constructs to the language as well as adding support for transaction receipts on the blockchain side. Events, however, are not indexed yet and hence querying for events that satisfy certain conditions (such as all events that contain a certain parameter) is not feasible. We plan to support efficient queries in the next release.