The First AI on Blockchain TestNet Release in the History of Mankind: Bernard & Dolores Beta
Smart Contracts may be one of the biggest drives behind the enthusiasm for blockchain. The idea is to digitally facilitate, verify, and enforce the negotiation and execution of a contract, which is carried out simultaneously in a distributed fashion on multiple nodes in a blockchain. However, the current smart contract protocol is far from perfect, suffering from both limited computing capacity and flawed governance.
The simplicity of the smart contract may not seem to be a big issue right now but its limitations may pose a threat to applications on the blockchain. Without enhancing the capability of the smart contract it is hard to implement real-world decentralized applications on the blockchain.
Whilst there are various approaches to solving the problem, enabling AI on the blockchain and integrating AI to be nested within the smart contract offers us a powerful solution.
Cortex is the first decentralized public blockchain that makes AI model inference available on the blockchain, and programmable in smart contracts.
Cortex is the first project that has taken the AI on Blockchain route. The AI smart contract is the much needed mind-blowing feature missing in all popular blockchains today. Moreover, AI models will be democratized and users will gain control of their own data and get incentives to compete with big corporations.
Technical Development Progress
Over the past few months, the Cortex team has been working hard on several core aspects for this TestNet release. We have been testing model upload, AI inference, storage layer (for storing models), AI smart contract writing, standalone GPU miner and CPU miner on full nodes, PoW consensus using Cuckoo Cycle, native wallet, etc. For the last few weeks, our focus has mainly been on the mining and the block explorer called “Cerebro” and the integration with the core protocol.
Today, the team at Cortex is proud to announce that we have been making substantial progress and finally hit a technical milestone to unveil the mining TestNet, codename “Bernard”, and AI smart contract TestNet, codename “Dolores” Beta 1, which are both fictional characters. Bernard is an AI robot created by the founder of Westworld, Robert Ford, with the help of Dolores, the first generation AI robot, as a replica of the deceased founder, Arnold.
We are ahead of the schedule to release Dolores Beta which was set to be launched in Q1 of 2019
Bernard and Dolores TestNet serve as a big milestone as this is the first to enable AI inference on the blockchain to showcase to the world. Considering that the development of the Cortex main chain has yet to be complete, in order to avoid binary copycats, Cortex selectively opens a portion of the source code to prevent plagiarism from other projects, while everyone can read the TestNet’s blockchain data to verify its legitimacy. Once the main chain is released, Cortex will go fully open-source on the blockchain.
1. Cerebro Block Explorer & Cortex Wallet
A block explorer is a browser for the blockchain, similar to how we have browsers like Google Chrome for internet web pages, which displays the contents of individual blocks and transactions, the transaction histories, and balances of addresses. With Cortex block explorer, namely “Cerebro”, users can enjoy features most explorers have with additional perks.
In the Cerebro browser, In addition to the usual address, transaction, block, and other search and query functions, the most important and revolutionary changes are the addition of AI models, data uploads, and AI inference. There are currently two AI models already stored on the chain, and an AI smart contract that invokes the models to infer data. Cortex wallet will need to be installed to interact with the Cerebro browser. Please stay tuned for concrete steps on how to use the wallet and the explorer.
Cerebro Block Explorer Link: https://cerebro.cortexlabs.ai/
Cortex Wallet Download Link: https://github.com/CortexFoundation/Cortex_Release/
2. Cortex Full Node
We have deployed 10 full nodes distributing in 6 countries for our TestNet and the number of full nodes will increase in the upcoming months. For now, we have the full nodes distributed in the following places:
- Beijing, China
- Shanghai, China
- Hong Kong, China
- Silicon Valley, USA
- Los Angelas, USA
- Frankfurt, Germany
- London, UK
- Tokyo, Japan
- Singapore, Sinapore
Full nodes on our TestNet generate logs that reveals the running procedure of the AI smart contract, the calling of AI model and data, and the inference results.
Users are welcome to host their own nodes. Click here for the binary code and instruction.
3. Consensus Mechanism
We are a strong believer in one-machine-one-vote to allow more people to participate equally in the blockchain consensus. Cuckoo Cycle algorithm is selected as the consensus mechanism to allow commodity hardware to mine. Cuckoo cycle is one of the most promising ASIC-resistant frameworks due to the memory-intensive algorithm, yet with instant verification. It generates random bipartite graphs from a provided message and tries to find whether a subgraph with required property exists or not.
The current block rate is 15 seconds per block and the reward is 9 CTXC per block. Considering the nature of the PoW mechanism and possible changes in the ASIC mining industry, the PoW algorithm may be replaced as appropriate before the main chain goes live.
4. Mining Pool & Mining Software
Miners can connect their mining machines to our mining pool and configure the parameters to enable mining on Cortex. Miners can check statuses such as the entire computing power, the mining difficulty, and block height on the dashboard. We have developed a mining software for deployment on the GPU, which can set the mining address, wallet address, and connect to the Cortex pool for test mining.
Mining Pool Link: https://pool.cortexlabs.ai/
Mining Pool Address: miner.cortexlabs.ai:8009/
Mining Software Download Link: https://github.com/CortexFoundation/Cortex_Release/
5. AI Smart Contract
The writing of AI smart contract can be done with Solidity, the programming language used for Ethereum developers. Cortex’s CVM is backward-compatible with EVM but adds infer instructions. Developers can use Remix to write AI smart contract. We also allow users to upload their models. If you wish to upload your models, please contact us at email@example.com. The reason is that we need to retrain the models into quantized models before uploading.
Remix Editor Link: https://cerebro.cortexlabs.ai/remix/
6. Deterministic AI Inference: Synapse
Cortex provides “Synapse”, an integer inference engine to do deterministic AI inference. Cortex’s Synapse Technology is a deterministic inference engine that guarantees exactly the same result of an AI model in heterogenetic computing environments. determinacy is crucial in the blockchain, as consensus has to be formed upon smart contract outputs. It is non-trivial for widely-used AI inference engines (TVM, NNVM, etc.) to guarantee the determinacy because modern GPU introduces parallelism into the execution flow. Synapse utilizes both quantizations of AI models and deterministic GPU acceleration to make AI DApps available.
7. Quantization and Compression
Quantization in deep learning combines high performance with lightweight inference which reduces the computation and memory costs. Quantization allows models to be executed on the blockchain with relatively low cost but also provides consistent inferred results.
To further reduce the size of the models, model compression is essential for the efficient deployment of neural network models. Under the new set of limitation, precision could downgrade for most models. Currently, fine-tuning is needed to train the new integer models to reduce precision loss. With 8-bit integer models, we can achieve a compression rate of 25% (75% size reduction).
Our model, Cat/Dog classifier AI model, has achieved a promising result with quantization and compression. The size of the original VGG16 model is 528MB. We performed transfer learning to the original model and generated an integer model of 129MB. Finally, we further optimized and compressed the model with its size as small as 14.7MB.
8. Storage Layer
We use a customized P2P network for storing AI model and data storage based on Libtorrent to achieve more AI model and data storage. This design combines the P2P storage network with the blockchain, providing a high-availability decentralized storage to Cortex, while the storage API is compatible with more systems to enhance the system’s performance.
How to report issues and bugs?
Please direct your technical questions to firstname.lastname@example.org and our technical team will assist you on the matters.
According to the roadmap in the Whitepaper, we are ahead of our schedule. However, we will keep testing and optimizing the blockchain and tools. We will also continue to develop a more comprehensive and automated MRT (Model Representation Tool).
As the first infrastructural blockchain to support on-chain AI, we aim to build an open source developer community to facilitate the future development of AI and blockchain technology. The entire ecosystem will have a supportive open-source platform in AI and blockchain development while allowing developers in each field to focus on their respective expertise. We believe we have made the first step into the future with AI and Blockchain join force to drive technology innovation.
In the upcoming weeks we will release more details and tutorials.
Cortex is the first ever blockchain technology that allows the execution of AI algorithms on the blockchain. Cortex provides an AI platform and stack for developers to upload their models on the blockchain that can be integrated with the smart contract.