There is a lot of excitement around smart contracts these days — the idea that you can run computer programs in a decentralized, transparent, immutable and censorship-resistant manner is a powerful one. However, one severe limitation to the current smart contracts / DApps is that they cannot realistically incorporate and execute AI programs.
Running AI on the blockchain has traditionally been thought unrealistic or impossible due to various factors: the design of virtual machines, nondeterministic behaviors of AI models, and slow transaction speed of on-chain AI inference. Solving these engineering challenges is a nontrivial task and requires extremely deep knowledge of both AI and blockchain.
However, after countless hours of innovation and hard work, on June 26, 6 PM +8 GMT, the Cortex Team is proud to announce the launch of its MainNet:
The first decentralized world computer capable of running AI and AI-powered Dapps on the blockchain.
For the first time in human history, we are now able to efficiently run AI on the blockchain. Instead of a black box, every step of the AI inference is verified by network consensus to ensure decentralization, immutability, and transparency. This has huge implications for the decentralized world into which we are entering, as now smart contracts have become truly smart with the addition of AI algorithms.
In this official announcement, we will first overview the core technical innovations that have made running AI on the Cortex blockchain possible, briefly discuss the applications of AI smart contracts as well as Cortex’s vision for an open decentralized AI ecosystem on the blockchain, and then state the next steps in the development plan.
Core Technical Innovations
CVM (Cortex Virtual Machine)
One of the biggest reasons that conventional blockchains like Ethereum cannot effectively incorporate AI is that their virtual machines run on the CPU, not suited for executing nontrivial AI programs. Our CVM, on the other hand, utilizes the GPU, ideal for effectively executing AI programs.
Besides the AI infer instructions, the primary innovation of the CVM is a deterministic inference engine, called Synapse or the CVM Executor, that guarantees exactly the same result of an AI model in different computing environments and thereby making network consensus on AI program executions possible.
In addition, the CVM is backward-compatible with the EVM; therefore, it can run all the Ethereum DApps, and on top of that, incorporate AI into these DApps.
Link for further technical details: https://github.com/CortexFoundation/CortexTheseus/tree/dev/infernet
Model Representation Tool (MRT)
Due to the nondeterministic behaviors of deep neural network models across different devices, it was not possible to reach network consensus during their execution on the blockchain.
To solve this problem, we developed a deterministic quantization framework, the MRT, designed to convert floating-point models supported by nnvm into fixed-point models executable on the CVM while preventing significant loss of precision. Our quantization method, which incidentally has gained support from the official MXNet team, ensures no overflow and guarantees the deterministic outcome of the model execution.
Link for further technical details: https://github.com/CortexFoundation/tvm-cvm
Cortex uses Cuckoo Cycle for its proof of work algorithm. Cuckoo Cycle is a graph theory-based algorithm that is far less energy-intensive than most other CPU, GPU or ASIC-bound PoW algorithms. The goal is to lower mining requirements, ensuring true decentralization and laying the foundation for future scalability.
The difficulty adjusts dynamically so that on average, a block is produced every 15 seconds, i.e., 15s block time. This rate ensures the synchronization of the system state while preventing double-spend and history alteration unless an attacker possesses more than 51% of the network’s mining power.
Link for further technical details: https://github.com/CortexFoundation/CortexTheseus
Application of AI Smart Contracts
Almost all traditional apps nowadays incorporate AI to some degree, it is therefore hard to imagine the future of DApps without AI. The benefits of AI smart contracts are as evident as the benefits of smart contracts themselves: transparency, decentralization, disintermediation, immutability, etc. Here we enumerate five use cases thought of by the Cortex team alone, although it is almost certain that the best use cases are yet to be conceived by the community.
For example, a decentralized lending app can run an AI algorithm to determine your interest rate based on your personal credit history. The AI used to analyze your credit score is not a black box, but instead, every step of the AI inference is transparent to prevent discrimination and ensure fairness.
Stablecoins governed by AI algorithms with a clear guideline and transparent coin-issuing/burning process, based on decentralized AI inference network to ensure the coin’s validity and its value.
CryptoKitties would be much cuter, more life-like, and unique if they incorporated AI. Imagine these kitties moving dynamically and behaving uniquely depending on your personal experience interacting with them. While Ethereum is not able to execute AI models and allow for this user experience, this is something that Cortex can uniquely enable.
Blockchain finds many use cases in the insurance industry, where immutability, fairness, openness, and transparency are in high demand. AI can help improve underwriting decisions, better manage risks, and prevent fraud. An insurance DAO powered by on-chain AI can bring us better, cheaper, fairer, and less bureaucratic insurance.
Almost every aspect of Uber involves AI, from matching drivers and riders, route optimization, driver onboarding to determining fares. Therefore, if we want to build a decentralized Uber, it is necessary to be able to run AI on the blockchain.
The emergence of deepfakes (AI-manipulated videos that are indistinguishable to the human eye) poses a significant threat to society. Social stability will inevitably suffer if video recordings can simply be dismissed as untrustworthy in court. Anti-fake AI algorithms (algorithms that detect whether a video has been tampered with) will run on the blockchain to ensure their transparency and fairness, especially if they were to be used in court.
An Open Decentralized AI Ecosystem
Besides enabling AI smart contracts, the other part of the Cortex project is the building of an open decentralized AI ecosystem on the blockchain.
Cortex brings an important new party into the blockchain ecosystem (which traditionally consists of only DApp developers, users, and miners): AI developers.
AI developers upload trained AI models onto the storage layer of the Cortex blockchain. These models can later be either inferred on their own or incorporated into smart contracts by DApp developers. Each time an AI model is called, it’s model uploader gets rewards in CTXCs, coming from a part of the network transaction fees. (The transaction sender pays for the transaction fee by setting an endorphin limit and endorphin price, where endorphin is the unit that measures the computational effort required for the transaction, similar to the concept of Gas in Ethereum.)
This economic mechanism incentivizes AI developers to compete with each other in training and uploading better and better AI models, leading to an evolving decentralized AI ecosystem on the blockchain. Thus, good AI models will openly distributed on the Cortex blockchain instead of being monopolized by a few big corporations.
To start, Cortex has 23 models, trained with four datasets, that serve 7 different purposes. All models have been quantized using MRT (see above), ready to be inferred on the Cortex Virtual Machine (CVM).
Technical Development Plan
Next up, there will be three major milestones that we aim to reach.
First, we will upgrade the CVM + MRT. Right now, MRT is just a deterministic quantization framework — we hope to turn it into a full-fledged programming language that provides a complete instruction set and better deterministic support. Meanwhile, we want to upgrade the CVM to support more AI models, specifically dynamic models.
Second, we want to scale by working on possible layer 1 or 2 solution. Our initial target is to increase the TPS to 1000. We will also improve our DOPS (deterministic operations per second), which currently is at 10G DOPS.
Third, we will work to improve the privacy of the AI models. We are researching cryptographic solutions in order to implement shielded on-chain AI inferences. The current thinking is to use zk-starks or zk-snarks as one of the possible layer 1 solutions and trusted computing as a possible layer 2 solution.
Community Development Plan
Upon the MainNet Launch and the release of Cortex source code, the Cortex team is opening up the development to the decentralized open-source community around the world; however, the Cortex Foundation will continue to provide underlying support to the Cortex blockchain and its open-source ecosystem in many ways: we have established a developer forum (link)and will start to organize online and offline workshops to educate AI developers in navigating the Cortex ecosystem, set up bounty programs, and further develop the open-source technical collaboration mechanism (establish open model libraries and datasets); etc.
In terms of the AI Dapp ecosystem, the Cortex Foundation will work with Dapp developers and companies around the world to help implement more AI Dapps on the Cortex chain.
Meanwhile, we will work on cross-chain support: As programs in other blockchains may require running AI on-chain for reliability and transparency, they will be able to execute the AI models on our chain and get the results returned back to their chain for further processing.
Furthermore, we will closely collaborate with academia and industry for research partnerships and publications. Our unique core solutions to implement on-chain AI inference have already gained support from the official MXNet team. There will only be more of such collaborations and partnerships.
More Technical Information & References
Cortex Wallet: https://www.cortexlabs.ai/wallet
Block Explorer: https://cerebro.cortexlabs.ai/
Cortex Remix IDE: https://cerebro.cortexlabs.ai/remix
Full Nodes: https://github.com/CortexFoundation/CortexTheseus
Cortex Miner: https://github.com/CortexFoundation/PoolMiner
Token Swap: https://medium.com/cortexlabs/cortex-mainnet-token-swap-announcement-c06769c40663?postPublishedType=repub