Before you dismiss CryptOrchids as not technically interesting, please believe that’s how I feel about most projects in the NFT space, and I set out to create something unique, clever and only possible because of blockchain technology.
NFTs got a lot of mainstream attention recently and I couldn’t get excited about the space, despite feeling like collectibles are right up my alley. So I did a deep dive, started playing around with Solidity, and came up with CryptOrchids as a fun, small project I could build to learn more.
CryptOrchids are flowers that grow on the ethereum blockchain as ERC721 tokens or NFTs. When a CryptOrchid token is minted, it starts off as a seed.
A seed owner can germinate their seed, which calls a function on the CryptOrchids smart contract that makes a request to Chainlink VRF, a service that provides verifiably random numbers. The contract uses that random number to determine the species of the flower according to an n per 10k scale for each of the 10 species in the CryptOrchids genum - the Shenzen Nongke orchid is the most sought after species, germinating at a 1 in 10k seeds rate.
Germinating a seed starts the game - CryptOrchids are extremely sensitive and must be watered exactly every 7 days, within a 3 hour window.
All of the gameplay mechanics are stored on chain - when a seed is germinated, the contract stores the block timestamp as the plantedAt for the token. Each token also has a waterLevel integer, and we can then do math to determine if a particular plant is alive or dead.
A plant will be considered alive if it’s water level is equal to the number of complete growth cycles the plant has been alive, which looks something like this:
To give players a bit of slack time to water their flower, we provide a 3 hour watering window. So we can express that this way, where if the watering level is 1 less than fill cycles, but the modulo is within the watering window, the plant is still alive:
The result is a very simplified way to express the essence of a plant on the ethereum blockchain. Of course real world plants also need sunlight, and nutrients, and they grow different sizes and have things like reproductive cycles.
But from an ontological standpoint, I’m trying to move beyond 2D posters and more towards metaverse objects that behave like their real world counterparts. The contract also stores latin species names on chain, and the species are all real species found in the natural physical world.
Where I’d really like to take this project is to metaverses as 3d objects that owners can water inside the metaverse. I’ve started playing with the Decentraland SDK. It’s not much, it’s not earth or metaverse shattering stuff, but that’s the direction this is all going, and I’m super excited to be trying to make this happen. I can’t wait to be able to own a digital car, to race it in a racing universe, to use it for transportation in an RPG metaverse, or to auction it at a Mecum auto show in a metaverse. But cars are a lot more complex than plants, so I started here.
There’s a great little community popping up around the project, and there’s a lot of interesting social and gaming dynamics that are coming to the fore as people start to engage with the idea. Some have compared the game to Tomagotchis, which feels like a really nice compliment.
It’s been a really fun intro to Solidity, Ethereum and NFTs, but to be clear this is experimental and I while I wrote tests and QAed on Rinkeby extensively, I’m sure there are things that I don’t understand about Ethereum that may cause things to break down over time, so I’m very open to learning what naive mistakes I may have made here!
NFTs got a lot of mainstream attention recently and I couldn’t get excited about the space, despite feeling like collectibles are right up my alley. So I did a deep dive, started playing around with Solidity, and came up with CryptOrchids as a fun, small project I could build to learn more.
CryptOrchids are flowers that grow on the ethereum blockchain as ERC721 tokens or NFTs. When a CryptOrchid token is minted, it starts off as a seed.
A seed owner can germinate their seed, which calls a function on the CryptOrchids smart contract that makes a request to Chainlink VRF, a service that provides verifiably random numbers. The contract uses that random number to determine the species of the flower according to an n per 10k scale for each of the 10 species in the CryptOrchids genum - the Shenzen Nongke orchid is the most sought after species, germinating at a 1 in 10k seeds rate.
Germinating a seed starts the game - CryptOrchids are extremely sensitive and must be watered exactly every 7 days, within a 3 hour window.
All of the gameplay mechanics are stored on chain - when a seed is germinated, the contract stores the block timestamp as the plantedAt for the token. Each token also has a waterLevel integer, and we can then do math to determine if a particular plant is alive or dead.
A plant will be considered alive if it’s water level is equal to the number of complete growth cycles the plant has been alive, which looks something like this:
alive? = plantWaterLevel == Math.floor(plantAgeSeconds / GROWTH_CYCLE)
To give players a bit of slack time to water their flower, we provide a 3 hour watering window. So we can express that this way, where if the watering level is 1 less than fill cycles, but the modulo is within the watering window, the plant is still alive:
alive = plantWaterLevel + 1 == Math.floor(plantAgeSeconds / GROWTH_CYCLE) && (plantAgeSeconds % GROWTH_CYLCE) < WATERING_WINDOW
The result is a very simplified way to express the essence of a plant on the ethereum blockchain. Of course real world plants also need sunlight, and nutrients, and they grow different sizes and have things like reproductive cycles.
But from an ontological standpoint, I’m trying to move beyond 2D posters and more towards metaverse objects that behave like their real world counterparts. The contract also stores latin species names on chain, and the species are all real species found in the natural physical world.
Where I’d really like to take this project is to metaverses as 3d objects that owners can water inside the metaverse. I’ve started playing with the Decentraland SDK. It’s not much, it’s not earth or metaverse shattering stuff, but that’s the direction this is all going, and I’m super excited to be trying to make this happen. I can’t wait to be able to own a digital car, to race it in a racing universe, to use it for transportation in an RPG metaverse, or to auction it at a Mecum auto show in a metaverse. But cars are a lot more complex than plants, so I started here.
There’s a great little community popping up around the project, and there’s a lot of interesting social and gaming dynamics that are coming to the fore as people start to engage with the idea. Some have compared the game to Tomagotchis, which feels like a really nice compliment.
It’s been a really fun intro to Solidity, Ethereum and NFTs, but to be clear this is experimental and I while I wrote tests and QAed on Rinkeby extensively, I’m sure there are things that I don’t understand about Ethereum that may cause things to break down over time, so I’m very open to learning what naive mistakes I may have made here!