2020-nEthV — the EtherVirus

Andrew Parker
7 min readFeb 9, 2020


Put on your face masks and douse yourself in hand sanitiser, there’s a new virus making its way across the Ethereum network and none of us are safe.

…okay I don’t want to be accused of sensationalising, so there definitely isn’t a virus on the Ethereum network. But I’ve made a virus-related ERC-721 project I want to tell you guys about. So dust off your bio-hazard suits and let's get to the lab.

Photo by CDC on Unsplash

The ERC-721 Standard

The ERC-721 standard for non-fungible tokens has been around for a while now. If you’re reading this article, odds are you are at least familiar with NFTs. If not, way back in the distant memory that is 2018, I wrote a series of articles about the ERC-721 standard. They’re pretty comprehensive and people seem to like them, so if you want to familiarise yourself I suggest you start there.

The 721 standard has become a pretty central part of a lot of Ethereum projects, and since it was still in development it’s been rattling around in my brain. I’m not the sort to just mindlessly implement a standard and call it a project, but have always thought 721 lays the foundation for other cool things to be created. It gives a sturdy structure upon which you can build if inspiration strikes.

Stuff should be cooler

There are plenty of clever and creative people working on all sorts of projects right now — and I don’t pretend to know them all — so what I’m about to say shouldn’t be interpreted as a sleight against anybody specific. But I’ve always thought that NFT projects all feel a bit sterile and dormant. Don’t get me wrong, they often have great art-work, and I’ve seen all sorts of snazzy front-end magic, but I always strongly got to the feeling that all that was just fancy dressing on an otherwise stale cake.

I mean really, the only thing that sets any of our Ethereum projects apart from our shinier centralised cousins is the on-chain stuff. The meat of the sandwich, its raison d’etre, is whatever is going on on-chain. It has to work of course, but I think it also needs to innovate it some way. It doesn’t matter how, but when you’re working with something as novel as blockchain — one of the frontiers of modern technology — I think you owe it to yourself and to the devs of the future to try out new stuff and see what sticks. It can still have all the bells and whistles if you want, but I think in a world where the economic cost of duplicating a project is as close to 0 as it can be, it’s got to have something unique going on under the hood…. But maybe that’s just me.

Anyway, I’ve always wanted NFT’s to feel a little more alive. Don’t get me wrong, Crypto Kitties took the world by storm and rightfully so, it was an innovation. But the kitties are dormant. They don’t follow you around, they don’t age, they don’t die, they don’t even really exist anywhere even in the framework of the game. If we’re talking about things on an on-chain level, they only really exist when they’re breeding. Other than that they could live a thousand lifetimes and remain unchanged.

Again, to clarify, this is not a dig at CryptoKitties. They did what they set out to do extremely well. I’m just lamenting my general feeling that NFT collectibles don’t utilise the higher level of “real-ness” that being on-chain gives them compared to basically anything else digital.

Growing life on chain

For those savvy about how Ethereum works, the reason why our CryptoKitties don’t wander around the blockchain is simple — nothing happens without a transaction. There are no fully-on-chain automated processes, if you want something to change, a transaction has to happen to pay for those bits to change. You could rig up some ugly thing to automatically make transactions but that’s just centralisation with extra steps (expensive ones).

But I’ve always mused on the idea of playing with growth and tangibility on-chain. I think it’s the permanence of the mainnet which gives all our projects a little extra sense of importance, and knowing that most wallets are probably manned by people rather than bots (except for in trading mayhem), there is real fertile ground upon which to build something special.

A sick day well spent

Well last week I had an extremely mild cold. To even call it that would be to vastly exaggerate. I felt a little sick for a day or two.

Any other time, I would have said “ain’t nobody got time for that” and gone straight back to work. But of course, with all this scary media coverage about a potential pandemic spreading across the world, I was sure I had the Coronavirus. I live in Australia, far away from any major ports. But yes, it was definitely Coronavirus.

My hypochondria aside, I decided to do the sensible thing and stay at home, quarantining myself as one last selfless act. Obviously I’m fine, but this extended time spend indoors, thinking about the spread of viruses, and the regular Ethereum musings knocking around back there too, an idea struck me. It may be possible to garner this kind of organic behaviour in an Ethereum project after all.


The working title for my project was Pathogen721. In fact, that’s the name of the smart contract. The idea was to make an NFT which rather than being collected, traded and coveted, was an object to be avoided. Obviously not ignored, because we all get 1000 air drops a day that we ignore. But I wanted to create a project where NFTs have negative value.

So I created Pathogen 721, later EtherVirus, or the 2020-nEthV virus. It’s pretty simple really. 90% of it is more or less a standard ERC-721 implementation (with enumerable and metadata extensions of course).

However, when you receive an EtherVirus token, it splits into three. You are now infected. You have a week to get rid of those three tokens or you’ll be dead. Once you’re dead, you’re dead forever.

You can infect any address which has an ETH balance > 0 (to prevent people from sending them to unused addresses), and the address can’t already be dead or infected.

They also can’t be immune. To add an extra layer to the project, I made it so each virus token has a strain number. When you get rid of all three of your virus tokens, you’re immune to that strain, but every time a token is transferred, there’s a 20% chance the token will mutate and the strain number will increment by 1.


A quick detour to talk about this mutation. Some of you may be thinking:

“A 20% chance when a transaction is made?!? Are you trying tp do randomness at tx time?? Are you some kind of moron???”

Well the answer is yes, the kind of moron who understands incentives. The specific line of code which handles the mutation is this:

strain += (block.timestamp%STABILITY+1)/STABILITY;

and we all know that block.timestamp is so easy to cheat that I can’t think of an analogy. But what matters is whether a person wants to mutate the virus or not. If the virus mutates, the newly-made enemy has a version of the virus that the original attacker is not immune to. So as soon as they’re healthy, their victim can just infect them again. So the logical cheat would be to try to prevent mutation. But this only stops one incident of mutation, unless every player actively prevents mutation, the virus will keep mutating. Add to this that the tokens have no value at all, and never will due to their potentially infinite supply, and really, I don’t think it’s anything to worry about.

If you’re wondering about the slightly esoteric syntax above, I wanted the tx to cost the same whether it mutated or not.

Patient Zero

Back to the origin story, once I had the idea for the project, and since I had taken a day off anyway, I whipped up the smart contracts in an afternoon and built the rest around it over the following week. It’s now just over a week later, and I’ve just deployed to the mainnet. It may not be the shiniest NFT project you’ve ever seen, but for something whipped up by a solo dev who (as far as he knew) was on deaths door, in about a week, I’m pretty happy with it.

The repo is public and the smart contracts are published. My front-end coding style might be a little esoteric for some, because I’m not at all a fan of frameworks, but if any of it is useful to anyone, please help yourselves.

It’s been a hell of a week, and now I really need some sleep. Hopefully someone gets something out of this.

If you want to get your hands on a token, there are a few floating around for free on OpenSea. If not you can infect yourself using the EtherVirus dapp.



Andrew Parker

Codeslinger. Melbourne based Solidity developer for hire.