Preface: TrustBase is a parachain that helps developers around the world participate in the construction of the Polkadot ecosystem without barriers. It allows traditional Web developers, ordinary Java engineers and programmers in other conventional fields to enter the smart contract development project with a low threshold to expand the camp of Web3.0 builders. What we have to do is to provide the most basic language for global Web developers to create a Polkadot ecosystem and achieve the goal of the Web3.0 network.
In our envisioned Web3.0 world, credit currency will inevitably not stand the test of time. The physical currency has been tested for thousands of years, while the so-called “unanchor-less printing” legal tender has a very short history. It has only been 49 years since the collapse of the Bretton Woods monetary system (anchored by 35 dollars and 1 ounce of gold) in 1971.
The result of “no anchor money printing” for legal currency is unlimited leverage. The 49 years of increasing leverage has caused credit currencies to become more serious financial crises every single time. Under the financial crisis, global central banks broke their trust due to excessive currency issuance. Had to seek the ancient currency anchor of the gold standard era to hedge which is gold.
We believe that gold has a natural underlying language given by the creator. It realizes scarcity, lightness and distinctive recognition in the molecular dimension. Throughout human history, people’s consensus on gold is essentially the worship of this “natural technology”.
Technology often reflects its past, but it will be faster, better, or more robust than before. On November 1, 2008, Satoshi Nakamoto sat in front of the computer and finally examined his masterpiece-”Bitcoin: A Peer-to-Peer Electronic Cash System”. He clicked the send button, and the paper quietly entered the cryptography mailing group of the geek website. At this time, people who are asleep in the middle of the night do not know that a new era has quietly begun, and how much change Bitcoin and blockchain will bring to society.
Bitcoin is an artificial realization of gold’s “natural underlying language” copied to the network layer. In the financial monopoly environment of Web2.0, Bitcoin allows mankind to see “money freedom”. This is a new generation of value network that grows brutally under the classy Web2.0, which is a new foreign exchange anchor against the hegemony of the US dollar.
Behind the achievements of Bitcoin is the precise construction of its underlying scripting language. We prefer to regard the Bitcoin scripting language as a work of art. It is full of the simple beauty of structure and ingenious wisdom. It reflects the technical nature of gold and is full of the vision of a healthy economy under the gold standard. The source code of Bitcoin is the Garden of Eden where we develop our own language.
A truly valuable language must be simple enough. “Simplicity” does not mean simple, but it must be like a general model. Bitcoin’s scripting language and gold use the same model that focuses on scarcity and security, but at the expense of flexibility. It is difficult for the Bitcoin system to have a smart contract ecology because of the underlying limitation of this flexibility.
The best in terms of flexibility is undeniably the Solidity language of Ethereum, which almost defines the achievement of Blockchain smart contracts on its own. But for now, Solidity appears to be too flexible. For example, within the scope, there is no absolute order relationship between the definition declaration and the call of Solidity’s state variables. The definition statement can follow the call statement. Features like this allow Ethereum’s smart contracts to “lay logic on top of logic”, which is the root cause of frequent DeFi contract vulnerabilities in Ethereum.
Faced with the choice between “safe” and “flexible”, we have learned from the ancient wisdom of the East. The core spirit of the Bitcoin scripting language and the Solidity language were integrated, and started under Polkadot’s Substrate framework.
We have designed a lightweight new language for the hope of Web3.0 “Polkadot” that we believe in: Subscript. In September 2020, this language was selected by the Grant Program of the Web3.0 Foundation and became an official Polkadot developer tool.
Subscript follows the syntax of Javascript, and completes the encapsulation of Substrate smart contract API and SDK in Assembly Script. Simply put, Subscript implements the ability to support any Web developer to quickly deploy Polkadot’s native smart contracts. Our developers do not need to learn the Rust language required by the Substrate framework, nor do they need to be proficient in technical problems such as Merkle trees, consensus protocols, and P2P.
“Seeing Subscirpt is like seeing an old friend.” Yes, we hope to use the Subscript language to tell the world that perhaps even under the competition of the Web2.0 Internet industry, even the best developers will be eliminated by the market if they are not proficient in the new language. But the word “eliminated” does not exist in the Web3.0 dictionary. Web3.0 will be a set of inclusive agreements, building blocks for application developers. These building blocks replace traditional Web technologies, but provide a whole new way of developing applications. In this way, Web3.0 will be compatible with all the basic underlying languages that have been recognized, and will also accommodate outstanding developers worldwide.
The number of developers proficient in smart contract development languages is far from enough. And we don’t want to see excellent traditional developers stand on the opposite side of Polkadot and sigh. After our construction, any smart contract application and Subscript-based programming tool developed using the Subscript language will share the global interoperability with Polkadot through the Parachain TrustBase.
This language must sacrifice some flexibility in exchange for the shared security of Polkadot’s native smart contracts. If we compare Subscript with Ethereum’s long-standing Solidity language, Subscript sacrifices a certain degree of flexibility. It inherits the spirit of Bitcoin source code and Javascript, and realizes the underlying security and strict typing. At the same time, we allow it to support any smart contract development platform compatible with the Substrate architecture, not limited to the TrustBase Parachain. In terms of syntax and development environment, traversing all known smart contract development languages, no language is more basic than Subscript.
Subscript is designed for WASM from API to syntax. It uses strict type and language checking as a whole, while providing paradigm functions to support the encapsulation of third-party libraries.
The following is our concrete realization:
a. Static Syntax Checking. Different from TypeScript, which is aimed at dynamic type operating environment, Subscript has strict static syntax checking when compiling, avoiding the dynamic feature of TypeScript not being able to effectively compile in advance. By assigning or inferring certain types, the compiler can produce predictable performance from the start of execution while ensuring that the generated WASM object code is small enough.
b. Strict Type. The basic types in Subscript are designed for the WASM standard, using WASM-specific integer and floating-point types. When dealing with numeric types, developers are allowed to realize the ideal type of numeric values.
c. Low-layer Access Support. When the smart contract interacts with the environment outside the sandbox, the parameters that can be passed are limited to basic integer types. Subscript provides a complete syntax that can be used to define external interface types. Subscript also comes with its own command functions that can access the underlying WASM, providing integer operations, virtual machine stack access, memory loading and other operations.
d. Paradigm support. Define paradigm types to support code reuse. Subscript defines a series of reusable library functions through paradigms.
Our vision is to “make simple language great again.” Gold provides a natural paradigm for the underlying language technology, Bitcoin opens the basic Blockchain scripting language, and Ethereum expands more financial transactions. TrustBase hopes to create a more general language model. We are Polkadot’s extraditioners. If Polkadot breaks the barrier between public chains, then Subscript will break the barriers between all development engineers and achieve the goals of Web3.