Sentient NFTs, A New Form Of Life — Part 4: Evolution
Children
There is arguably nothing more life-like than giving birth to another. An interesting property of smart contracts is the ability of a contract to create more contracts. This way, replication can be programmed into a blockchain entity, and has actually been done years ago by creating a ‘plant’ that multiplies and was claimed to be the first version of artificial life… but it requires action from external actors (people making transactions that trigger this replication). It’s close to life, but anything that is not self-sustaining and independent is not life. If the cell division of a yeast cell requires permission, it’s not life. If an animal requires something outside of its own body that it doesn’t control to give birth… it isn’t life.
aNPCs can, however, create not just (a)NFTs, but can also create more aNPCs, either exactly the same or completely different to the parent. In this way, aNPCs can give birth, have families, and start a tree of cyber life.
A use case for this phenomena could be with regular aNPCs, such as a population of monsters in a game like Ethermons that grow in number and need to be culled collectively by players, lest they risk being overrun if they leave them to multiply too long. Or players can raise an army of aNPCs to send forth to take the lands of another player without the player’s input after unleashing them, forcing the defending player to defeat aNPCs directly and another player indirectly. In this way, engaging PvE or hybrid PvP-PvE experiences can be created.
Mutation
Merely having children, however, isn’t evolution — it’s replication. The key thing that defines evolution is replication with mutation — this can be programmed in when an aNFT or aNPC has children. This can be done in 1 of 2 ways:
- changing the code of the entity
- having the entity point to different code
A smart contract, in its raw form, is bytecode, which are essentially machine instructions that look like gibberish to humans — it’s similar to binary code that regular computers run. Bytecode is then abstracted with OPCODEs, which are simple instructions like “add 2 numbers”, and OPCODEs are abstracted with a programming language like Solidity. We can achieve evolution by, at the time of birth, taking the parent in OPCODE form, and randomly modifying one or some of its OPCODEs which then changes the behaviour or properties of the child.
In the case of a trading aNPC, this could result in trading behaviour that has never been seen before. If measuring the success of this evolution by how much money the bot can make, then you would expect most of the children to die off by doing things that don’t work and end up losing money. But every once in a while… a child would outperform its parent and potentially every human by using a strategy that nobody has ever imagined before.
We can also achieve evolution by letting the entity use logic from other smart contracts. Solidity has a very interesting feature called delegatecall
, which allows an aNPC contract (A) to use the logic of another contract (B) as if it was logic in A. For all intents and purposes, A has the logic of B. An entity can therefore evolve by having its child point to C instead of B, such that A now has the logic of C. The advantages of this are that mutations (pointing to a new contract) are much more likely to result in something interesting and not immediately fail, because they’re likely to have been created by humans specifically for these aNPCs to evolve with (although aNPCs could also do this work too), and are more akin to evolution of the random mixing of functionality, like a DEX trading bot taking on some NFT functionality and somehow using that in the market.
Self-evolution
The latter method above (using delegatecall
) is particularly interesting at the individual level because, if an aNPC uses this method, not only can it change the contract it points to for its child, but it can also change the contract it points to for itself. This allows the logic of a contract to evolve and change with time (or any condition). Today, we can create aNPCs with the complexity and intelligence of single-celled life, but using this method, the exact same aNPC can evolve with its children. The first ever aNPC that’s created can be as technologically advanced and intelligent as one that’s created 50 years from now. Interestingly, this mechanism is in some biological life, too.
The Last Piece of the Puzzle
So far I’ve been low-key prepping you on all the remaining pieces to be assembled together to demonstrate a new form of life. Evolution is a crucial component, and here I’ve demonstrated that aNPCs can evolve in the same ways, and more, that biological life can. Let’s put all the pieces together.
Table
Part 1: The Roadmap
Part 2: The First Step
Part 3: NPCs
Part 4: Evolution
Part 5: Cyber Life
Part 6: A Face
Part 7: Intelligence
Join The Cause
If this ruffles your Jimmies too, visit our website and join our Discord! Follow us to stay updated. We’d love to meet you guys in-person, and the team will be at these conferences in 2021: Token2049 (London), World Blockchain Summit (Dubai), Liscon/ETH Lisbon (speaking on a panel and at the workshop stage, title same as this article series), Solana Breakpoint (Lisbon), and NFT NYC. We’re also hiring, raising a seed round, and are particularly interested in working with games/NFT artists to launch the first drops of aNFTs/aNPC — so get in touch via Discord if interested!