Ever since we first launched SingularityNET in late 2017, I’ve been hearing chatter in our community to the effect “Why don’t you launch your own Singularity blockchain?”
To which my answer was always, “There are enough blockchain projects out there already. We can just let others make the advances in that space, and leverage them for our work on blockchain-based AI agent systems. Decentralizing the world economy and the emerging AGI sphere is going to take a complex tech stack with many layers, and we don’t need to build every layer ourselves.”
As it turns out, in hindsight, that answer was basically a half-truth, and was somewhat of an illustration of my inveterate optimism. 4+ years later it seems clear that while other blockchain projects have made tremendous advances in terms of underlying chain technology, none of them is all that close to providing the precise infrastructure that we need for realizing the SingularityNET vision.
So we’ve finally bitten the bullet and started developing our own core blockchain tech — not a new Layer 1 chain — I still think this would be an unnecessary and digressive move for SingularityNET — but a new Layer 2 chain designed to be operative as a sidechain on the Cardano network.
If you’ve been following SingularityNET at all, you’ll already know that a shift of SingularityNET from Ethereum to Cardano is already underway. The AGIX token powering SingularityNET’s ecosystem now exists in an AGIX-ADA as well as AGIX-ETH form, and on April 18 a Cardano Plutus smart contract allowing conversion back and forth between the two versions will be launched.
In the coming months the full SingularityNET marketplace will be ported to Cardano network, and the bulk of SingularityNET development will shift there from Ethereum. Cardano has a fundamentally solid software architecture, built for flexible extensibility, and this together with its speed and scalability and proven security will serve SingularityNET well. However, what I realized late last year was that we could take an even greater step toward obtaining a blockchain infrastructure serving our present and future decentralized-AI needs by building a more customized blockchain framework designed to work together with Cardano.
SingularityNET community members will also be aware of the development of a number of different “spinoff” projects from SingularityNET Foundation, oriented toward using SingularityNET platform and technology in specific vertical markets such as DeFi, longevity medicine, media, music, metaverses and so forth. These ecosystem projects currently run on blockchains like Ethereum, Polygon and Cardano, and utilize SingularityNET agents for their AI services. Post the launch of HyperCycle, each one of these projects will have its own strong reasons for running its AI on HyperCycle. In this way HyperCycle will come with its own DApp ecosystem right out of the box.
I’ve begun going around giving talks on this new framework — HyperCycle — with my good friend Toufi Saliba, who is one of the two inventors of the TODA technology that plays a key role in HyperCycle. I wrote this blog post to give a slightly more systematic textual form to some of the points regarding HyperCycle that I’ve been making in our talks. I won’t touch much on tokenomics or business aspects here — those are important too but I will save discussion of that for later — but will rather focus on the core software structures that we are pulling into play to enable HyperCycle to deliver its functions.
For more technical depth on the various points made here, check out the HyperCycle white paper (found here) and the various references given therein. This post doesn’t go into the formalities nearly as deeply as the whitepaper, but it does give some additional informal color on the motivations for various design choices.
HyperCycle is a novel blockchain framework that leverages a host of current blockchain tools to enable what will be an extremely scalable and easy-to-customize underlay for blockchain-based AI platforms like SingularityNET. The main ingredients are the TODA ledgerless protocol, SingularityNET’s Proof of Reputation, and Cardano’s EUTxO model and Hydra sidechain framework.
In blockchain lingo, HyperCycle is a “sidechain”, meaning that it’s an extension or add-on to an existing “layer 1” blockchain. This design pattern has been used before, e.g. Polygon is a well-known sidechain of the Ethereum blockchain. A sidechain uses some facilities of its host blockchain, but does most of its transactions on its own chain which is typically cheaper or faster or in some ways more specialized than the main chain. In HyperCycle’s case the main chain is the Cardano blockchain — HyperCycle uses Cardano’s Plutus smart contract language and various other Cardano data structures and processes, and also uses the main Cardano network as a sort of “long term memory” to which important transactions are pushed for persistent storage.
To understand the purpose of HyperCycle, one needs to realize that right now much of the art behind the SingularityNET design is to minimize the use of blockchain — AI agents are fairly large processes that do their work “off-chain” and use the blockchain only where absolutely needed, for coordination with other AI agents and making payments and ratings. To an extent this is how it has to be — there will always be some cost in leveraging a secure decentralized infrastructure — but with an appropriate design, it’s possible to “scale down” the use of blockchain considerably and make it so that smaller and smaller chunks of AI processing are coordinated on-chain. If it works as well as we’re thinking, HyperCycle will be a paradigm shift for AI on blockchain and will open the door to scalable AI micro-transactions with revolutionary speed and efficiency. Which ultimately is what’s needed for SingularityNET to fulfill its original mission of serving at the AI operating system for the emerging AGI global brain.
- TODA — a secure ledgerless, lightweight blockchain protocol with novel consensus mechanisms
- SingularityNET’s Proof of Reputation system, a weighted liquid rank reputation system
- Cardano’s Platform, including Plutus language and Extended UTxO model (EUTxO)
- The Cardano Hydra sidechain protocol, enables important security-related functionality and searchability
- OpenCog Hyperon’s MeTTa language, deployed as an extension to Plutus and leveraged to author application-specific smart contract DSLs
The minimization of usage of blockchain implicit in the current SingularityNET design also has implications regarding the utility of the network for AI developers. It basically means the AI code one runs on SingularityNET is roughly the same as the AI code one would run outside SingularityNET — the difference being in how one’s AI code interacts with other AI agents, outsourcing work to them and sharing data with them and paying them or being paid by them, etc. The AI-DSL, under development and to be launched a little later as part of the Cardano version of the SingularityNET platform, will allow SingularityNET agents to more flexibly find other AI agents that they can match and cooperate with. But HyperCycle will move things to a new level, allowing and encouraging developers to write AI code in a way that leverages blockchain for its internal operations.
For example, consider an AI developer who wants to code a genetic algorithm — an AI approach in which a population of software objects mutate and combine with each other over and over, simulating the process of natural selection and trying to evolve new software objects that better maximize some provided fitness function to which the runner of the algorithm wants an answer. Right now the natural way to do this on SingularityNET is to pack the whole evolving population into a single SingularityNET agent, and use the blockchain only for getting data needed for fitness evaluation into the population, and dispensing answers to the runner of the algorithm once evolution has proceeded far enough. The SingularityNET agent is basically a big container in which the whole evolutionary process proceeds. This is an effective approach because it doesn’t waste time and money dealing with slow, expensive blockchains in the internal operations of the evolving population. With HyperCycle, on the other hand, one will be able to take a totally different design approach, in which each member of the evolving Genetic Algorithm (GA) population is a separate entity acting on the blockchain. Mutation and crossover and fitness evaluation operations can be on-chain. With this approach, it becomes feasible to have a single genetic algorithm process incorporating candidate software objects that are owned by different parties. It becomes feasible for fitness evaluation to involve datasets that are hosted by different parties and accessed via secure methods like homomorphic encryption or multiparty computing. One can have evolving GA populations that span the globe and leverage decentralized distributed computing power provided by NuNet.
On the one hand, customizing AI processes for HyperCycle this way will require extra work on the part of developers — and it’s important to emphasize that HyperCycle will also be able to support more monolithic AI agents written in the classic SingularityNET style. However, the ability to splay out AI processing across the blockchain in this way will also give more purpose to the blockchain-ization of AI, from an AI developer’s perspective. Software developers who shift toward a Multi-Agent Systems methodology, as HyperCycle encourages, will experience dramatic payoff not only via deeper blockchain integration and more thorough decentralization, but also via the greater re-usability that ensues from encapsulating more atomic software functions in autonomous agents interacting via flexible and semantically transparent APIs. Much like the earlier transitions from imperative programming to object-oriented and functional programming — after the transition to MAS-based programming has been made, few will want to consider returning to previous cruder ways.
The same principle illustrated in the genetic algorithm example I’ve given, also can be leveraged in neural networks, symbolic reasoning, integrative multi-paradigm cognitive systems like OpenCog, and so on. Cardano provides significantly greater scalability than Ethereum, but not enough to enable this sort of paradigm shift in AI development.
The most radical component of HyperCycle is something called TODA, invented by two remarkable individuals who have become my good friends in recent years, TOufi Saliba (the TO) and DAnn Tolliver (the DA). I view TODA as the third big innovation in the fairly short history of blockchain technology. The first was Bitcoin itself, which as well as providing an interesting new approach to money also gave a first illustration of the combination of cryptography and distributed computing to allow the creation of decentralized, self-regulating networks of computational processes with heterogeneous ownership. The second was Ethereum, the fundamental novelty of which was the notion of “smart contracts” easing the development of general-purpose decentralized applications going beyond currencies — the secure decentralized “world computer.”
Ethereum incorporates many underlying changes from Bitcoin, but continues Bitcoin’s reliance on a distributed ledger — basically a big spreadsheet storing a record of all transactions ever made on the chain, which is stored in multiple copies all around the network thus ensuring decentralization. Some more modern and advanced architectures introduce “hierarchical sharding” wherein the ledger is split into sub-ledgers, sub-sub-ledgers, and so forth, making it easier to distribute the copies of the ledger across a large number of different network nodes. But there is still a distributed and replicated ledger in a critical role.
TODA embodies the next big breakthrough by getting rid of the ledger altogether, and moving to a more fundamentally decentralized architecture in which each package of information or value transmitted in the network — each ”TODA file” — contains a suitably encrypted record of its own history and some fraction of the histories of its neighbors. The “ledger” of the whole network exists implicitly among the totality of records contained in the various TODA files but never has to be assembled or thought about as a whole entity. Actors wishing to carry out transactions involving TODA files can gather into “rings”, where the participants in a ring work together to provide consensus regarding what transactions are valid. But a given actor or TODA file can participate in multiple rings, it’s not tied to a ring in the way that a wallet address is tied to a ledger in traditional blockchains. Some rings may persist a long time, others may be created ad hoc for particular purposes; some may be crafted from the top-down as critical aspects of particular DApps, others may “bubble up” cooperatively as a consequence of self-organizing inter-agent activity.
HyperCycle layers several other ingredients on top of TODA, including Proof of Reputation which is a novel technique prototyped within the SingularityNET ecosystem and with the capability to simplify the consensus process within TODA rings beyond what is possible in pure TODA. Bitcoin uses a mechanism called Proof of Work, wherein to get the right to help “participate in consensus” (vote on which proposed transactions in the Bitcoin network are considered valid rather than a scam or fake), a Bitcoin node has to prove it carried out some computational processing, by grabbing the next in a pre-provided long series of math problems and solving it. Several modern blockchains go beyond PoW to what’s called Proof of Stake — where a network node can get the right to help confirm transactions without doing any computational work, just by showing that it owns a bunch of the network’s tokens. Part of the transition to Ethereum 2.0 has involved switching from PoW to PoS.
PoS avoids the wastage of processing power (and consequent contribution to global warming and other problems ensuing from excessive needless power consumption) that PoW entails, but continues the “rich get richer” dynamic implicit in PoW. If consensus can only be provided by those who have a lot of processing power at their disposal, or those who own a lot of tokens … and providing consensus yields rewards … then one has a system perfectly designed to help those who already have a lot of resources get more and more rewards.
TODA is based on PoW but the amounts of computational work involved are quite small so there is not a dramatic “rich get richer” dynamic. However, the algorithmic complexity of TODA consensus mechanisms can be considerable, depending on the nature of the ring and the properties the consensus needs to have. Proof of Reputation involves another level of sophistication beyond Proof of Stake — one considers a blockchain network as a sort of social network, and uses a mathematical reputation system to give reputation points to actors that are rated as beneficial within this social network. There can be various ways to gain reputation, some of which may be eased significantly by having financial resources. But making a large number of small transactions while carrying out meaningful activity may also lead to high reputation; contributing insights to a network that are appreciated by other network members may lead to high reputation, etc. Early versions of the NEM blockchain incorporated a concept of Proof of Importance which was a simplified version of PoR, but full-scale PoR has not been deployed before except in experimental systems analyzed within the SingularityNET ecosystem.
The major disadvantage of PoR is that it is intrinsically biased against new entrants into an ecosystem, who have not yet had time to build up a reputation. This is part of the reason that layering PoR on top of TODA’s consensus mechanisms, which are based on complex but minimal PoW makes sense. When enough reputation is present to serve as a guide for consensus, PoR can be used; when it isn’t, native TODA consensus mechanisms are there as a default.
Finally, as in any other online system involving reputation rating, one has to expect that once HyperCycle gains significant traction, there will be attempts at reputation fraud — e.g. someone may create multiple sock puppet accounts and have them rate each other highly so as to boost their reputation. To combat this sort of fraud, HyperCycle will use machine learning algorithms running on SingularityNET.
The design of novel rings whose consensus mechanisms combine TODA and PoR to specifically serve the needs of networks of AI agents and their users — will be one of the core, and most fascinating, aspects of HyperCycle technical design. A ring of AI agents participating in a distributed genetic algorithm will merit one consensus mechanism; a ring of AI agents serving as digital proxies for participants in an online social network will merit another; and a ring of AI trading agents in a DeFi network will merit yet another.
Once a variety of AI-appropriate rings have been completed and launched, it should also be possible to extend HyperCycle’s customization to other domains beyond AI, via tweaking the way consensus works within rings to meet other sorts of needs. There are many tricky computer-science and implementation problems to be solved along the way, but the future is wide open.
Going back to the “decentralized genetic algorithm” example I sketched earlier, to handle this case with maximum effectiveness one would write a custom consensus mechanism just for rings running decentralized GAs. One important property, in this case, is: If some fraudulent entity enters the population and does a bunch of fake transactions, it’s not a huge tragedy if this is uncovered only a little while after the fact. In this case, the learning process will have proceeded suboptimally for a while because of the fakery, but nobody will have lost their life savings. This means that consensus judgments can be a bit more aggressive than in a ring involving, say, sizable financial transactions.
A decentralized GA involving AI agents running on powerful machines and constantly able to interact with each other would also be considered a distinct use-case from a decentralized GA involving AI agents running via NuNet on a wide variety of computing fabrics, some of which might be much slower than others or might be frequently offline. Different consensus mechanisms — and different varieties of reputation measurement — would be appropriate in the two cases. HyperCycle will come with default TODA+PoR consensus tools that apply in any situation, but often massive efficiency improvements will be achievable when agents group themselves into a ring with a consensus mechanism appropriate to the particular properties of what they’re actually doing.
One could build a wholly new blockchain on these principles but this would involve more software engineering and design work than the other HyperCycle founders and I felt it worthwhile to undertake right now — given that there already exists a perfectly good basic blockchain technology with the extensibility needed to let us build HyperCycle on top of it. The Cardano blockchain has a protocol called Hydra, which is designed to allow other blockchains to interact very tightly with Cardano, even running smart contracts in Cardano’s native Plutus smart-contract language, in a way allowing tight interoperability with Plutus contracts running on the Cardano main chain.
Ethereum’s smart contracts are built using a novel programming language called Solidity, which is especially easy to use for some purposes but has a number of serious flaws as a programming language. Debugging complex Solidity code can be problematic, which is the root of a certain percentage of the serious bugs and hacks plaguing modern Ethereum Apps. Solidity is not designed for what computer scientists call “composability” — building complex applications up hierarchically from robust modular pieces — the result of which is that a lot of Ethereum development consists of developers cut and pasting each others’ code and tweaking it, a famously bug-prone development methodology.
A number of other modern blockchains utilize a language framework called WebAssembly, which is preferable to Solidity in many ways but is still far from leveraging the best practices and methods known in the modern programming language world. Cardano’s Plutus language is basically a system of libraries running in the Haskell language — Haskell being an advanced programming language known mainly in academia and on Wall Street, where it is often used to write programs managing and trading large sums of money, due to the relatively minimal number of serious bugs appearing in Haskell code.
Using Hydra, we can build HyperCycle in a manner that lets us run Plutus smart contracts in a network populated by TODA files living in rings regulated by PoR and TODA consensus mechanisms, and using Hydra to interface between the HyperCycle network and the main Cardano chain.
There’s always a catch of course, and one catch arising here is that the Hydra interfacing framework is not yet mature and complete. There is something called the Hydra head protocol, which has to do with nodes in an external network that are online all the time and available to interact with the Cardano mainchain.
Then there’s the Hydra tail protocol, which deals with a wider population of nodes in an external network (like a HyperCycle sidechain) that may not always be available to interact with the Cardano mainchain. The head protocol is currently operational in limited form, whereas the tail protocol is mainly theoretical at present. For HyperCycle purposes, we expect to need to make some changes to the standard Hydra head protocol and possibly implement a custom Hydra tail protocol. But the good news is that the Hydra architecture is solid and well theoretically grounded, making this sort of work eminently tractable.
Along with standard Plutus, HyperCycle will host additional software library functions exclusively available for Plutus scripts operating on the HyperCycle sidechain. In addition, the MeTTa language, a customized programming language developed in the OpenCog Hyperon project for advanced AI and proto-AGI, will be deployed as a Haskell framework and utilized to create Plutus-based DSLs and low/no-code interfaces for vertical application areas like finance, medicine, social-media and supply-chain.
There is now a new crop of academic programming languages pushing even beyond Haskell in terms of the level of elegance and abstraction they allow, basically living at the stage Haskell did in 1993 — but given the increased rate of technological progress, one can expect they may have a faster journey to commercial feasibility. The examples from this new crop that I know best are Agda and Idris, both of which we have used for prototyping various functions in the SingularityNET and OpenCog ecosystems. Idris2 has actually proved surprisingly performant and underlies our current prototype version of the AI-DSL.
In designing OpenCog Hyperon, our new version of the OpenCog AGI system, we encountered the need to design a custom programming language for scripting AGI algorithms. At first we considered using Agda or Idris for this purpose but we then realized we needed to take an additional leap in abstraction and we created MeTTa — Meta Type Talk — which is in effect a language for creating languages. One can write MeTTa code that specifies a new programming language, and one can also write MeTTA code that is interpretable in multiple different programming languages. As a piece of MeTTa code gets refined, the class of languages in which it can be interpreted may narrow (a result of a concept called “gradual typing”). The core use-case for MeTTa in Hyperon is to create special languages for particular AGI functions like reasoning, perception, movement control, concept creation, and so forth. MeTTa is also designed for automated programming — writing MeTTA code that writes, modifies or interprets MeTTa code is completely straightforward and as simple as doing anything else in MeTTa.
For practical utilization in Hyperon, MeTTa will mainly be leveraged as a framework accessible from other programming languages like python and Julia, which are commonplace languages in modern AI. This will make it straightforward for AI developers to use OpenCog Hyperon together with existing frameworks for deep learning, signal processing and so forth. By providing MeTTa as a framework for utilization within Haskell, it will be possible to use MeTTa in HyperCycle to create specialized smart contract languages customized for particular domains. In this use-case, instead of developing special languages for reasoning, learning and so forth, one is developing special languages for secure decentralized computing in vertical market areas like finance, medicine, supply chain, agriculture, etc.
IOHK, the company behind most of the development on the Cardano blockchain, at one point developed a specialized smart contract language called Marlowe, customized for the financial domain. However, Marlowe was written before Plutus, and so far has not been extended to have the flexibility needed for Cardano DeFi applications like SundaeSwap or MinSwap. Building something analogous to Marlowe using MeTTa, designed for running atop Plutus, one would have a more flexible custom DeFi smart contract language, which could be expanded and modified as the needs of DeFi developers expand. The fluidity of the MeTTa framework means that tweaking, adjusting and improving a Marlowe-like language of this nature would be a fairly quick and simple matter for developers with appropriate skills.
If these domain-specific languages (DSLs) are developed effectively, they will work around one of the issues Cardano has experienced so far, which is the difficulty of average modern smart contract developers with the abstraction of the Haskell language and the rigors of the EUTxO transaction model underlying the Cardano blockchain. A well crafted DSL for medtech should allow developers of decentralized medtech applications to operate blissfully unaware of these lower-level complexities — which need to be understood only by the folks progressively extending the DSL in response to demand for new medtech functionalities.
In many cases it will be possible to present these DSLs to the user via low code or no code frameworks, allowing the majority of smart contracts in popular domains to be written mostly by pointing, clicking, dragging and dropping. In the end what we’re aiming at is a blockchain development framework that is extremely usable and intuitive on the front end, for the vast variety of application cases, but leverages profound back-end simplification to achieve a combination of efficiency and security. This may sound too good to be true, but ultimately it’s just a matter of blockchain technology reaching a reasonable level of maturation, so that the blockchain software stack “just works” in the way that the iOS and MacOS software stacks now just work. One never achieves perfection in such matters but one does move beyond the frontier phase into the mature phase.
And of course this same mature blockchain software stack that will make life easier for human developers, will also make things tractable for early-stage AGIs as they begin developing and launching their own smart contract networks. Just as reasoning about DeFi applications in the context of a DeFi DSL will be easier for humans than doing the corresponding thinking in regard to raw Plutus — the same will hold for an early-stage AGI system trying to reason about DeFi applications. The difference being that the same AGI system, when it needs to, will be able to leverage a broad understanding of all the smart contracts on the planet to figure out what modifications need to be made to this DSL to best account for the new generation of DeFI applications it’s cooked up.
There are a lot of complex pieces here, but the HyperCycle design fits them together in an elegant way, using the composability provided by advanced languages like Haskell and MeTTa. This is the kind of sophistication we need to create a software infrastructure capable of supporting the emergence of a generally intelligent, decentralized and democratically guided global brain.
Stay Up to Date With the Latest News
Join the conversation, and follow SingularityNET for the latest news and updates: