A Truly Beginner’s Guide — Ethereum (Part 3)
A Truly Beginner’s Guide — Ethereum (Part 3)
NFTs and Stablecoins and Tokens, oh my!
In the previous two parts (one, two), I explained what Ethereum is, what smart contracts are, and how they manage to exist on the blockchain. Now that all the groundwork is set up, we can finally discover what these innovations in blockchain technology have led to. In this final part we will discuss NFTs, Stablecoins, and Tokens.
If you’ve ever downloaded a slot machine app on your phone, you probably didn’t see the $1,000,000 balance and assume you were actually a millionaire. You understood that this balance was entirely confined to the game itself. However, if you were really unlucky with the slots game, you might’ve quickly found yourself at a $0 balance. Many games like this are free to download, but you can use real money to purchase this fake app money. When you do this, your bank sees that you made a purchase to the game developer, but they have no idea that you purchased another fake $1,000,000 casino bucks.
This same logic applies to the Ethereum blockchain. Ether would be the real money, because this is what miners charge for transactions, and it’s what is tied directly to your account balance. But just like the slot machine app can put a fake currency in their game, so too can a smart contract. Remember, smart contracts are code, just like the slot game.
Let’s go back to our allowance scenario. Recall that we want to give our child allowance on the first day of every month. We have decided we want to use Ethereum to do this, and instead of us having to remember each month to pay it, we wrote a smart contract to automatically pay the $20 worth of ether each month. But what if we are worried about our child selling the ether for real US Dollars, and using that money to buy candy at school. If we weren’t using the blockchain, one solution would be to pay the child in fake bills we print at home. Let’s call these “FakeBux”, and we give the child 20 of these each month. Any time the child wants to buy something, they give us FakeBux and we use our real USD to purchase the item for the child.
By doing this, we have isolated our child’s money from the larger economy, much like the slot game does. Within the game itself your fake money can do all sorts of things, but beyond the game it’s worthless. In the same way, as long as the child has our approval they can purchase whatever they want, but without our approval it’s worthless. We can easily implement this in our smart contract. Instead of having our smart contract pay the child $20 worth of ether each month, it will just increment a FakeBux number by 20. No ether is ever transferred from the smart contract to the child’s account, instead the smart contract just keeps track of how many FakeBux our child has. If our child wants to purchase something, they ask us and if we deem it allowed, they send a transaction to the smart contract, and the smart contract will then send the FakeBux back to our account. We will then use real USD to purchase the item for them.
In the image above, we can visualize this setup. The top left box represents our child’s account (identified as account 123). Below that is our account, 456, and finally we have our smart contract as 789 to the right. Remember that our smart contract is it’s own account, but it’s controlled entirely by the code we wrote for it. Each of our accounts has an ether balance: child has 0 because we don’t want them to have real ether, we have 10, and the smart contract has 2. If we were still paying allowance in ether, we could tell the allowance contract to pay the child a little of it’s ether each month. This would transfer some from allowance to child. Instead, we are doing FakeBux, and when we pay the child, we send a transaction on Ethereum to the allowance smart contract. We use ether to pay the fees and gas, and then a miner will run the code. After running, the allowance smart contract has added 20 to the number associated with the child’s account, and we’re done! This can be seen in the red boxes (the botttom three) of the allowance account.
Let’s pretend we have a second child and they are account 246. That is why we see a zero balance for account 246 in the smart contract. If this second child is older and perhaps gets 40 FakeBux a month, we can easily keep track of, and pay, both children different amounts each month. It’ll all be stored in a single smart contract. Neat!
We will have to use real ether to fund the transaction, pay fees, and purchase gas, but the miners don’t care at all about what’s going on in the contract — just like the bank doesn’t care about, or know, your virtual slots balance. As long as the miner gets paid for their work, they’re happy.
Tokens vs Coins
What I have just described, are tokens. They are a virtual currency similar to ether or bitcoin, but with one notable difference: they don’t pay for the work done on the blockchain. Cryptocurrencies used for blockchain specific tasks are called coins. Bitcoin and ether are both coins, because the miners get paid in this, while FakeBux is a token because, while it does live on the blockchain, it’s not used for paying miners, purchasing gas, or paying fees.
I spent a good amount of time on just tokens, this is because understanding what a token is makes understanding NFTs and Stablecoins a piece of cake. You see, NFT stands for Non-Fungible Token, and we already know what a token is. If something is fungible, it means they’re all the same value. Take gasoline, for example: If I drive your car for a day, and refill the tank before giving it back, no gas value is lost or gained, because the gas I used is no different than the gas I refilled it with. Gasoline is fungible. In contrast, what if you let me borrow your Ferrari, and I return a mini-van to you. Automobiles themselves are non-fungible, because they’re all worth different values.
Examples of fungible goods: dollar bills, poker chips, bottles of Coca-Cola.
Examples of non-fungible goods: Artists paintings, VIN numbers on cars, or plane tickets to different destinations (a ticket from New York to Miami is not interchangeable with a ticket from New York to Italy).
A Non-Fungible Token is simply a token that is somehow unique, and can’t be directly substituted with another. FakeBux would be fungible, because the 20 FakeBux from one month are no different than the 20 FakeBux from another. An example of an NFT could be a social security token. Let’s say the government has a smart contract on Ethereum called “SocialSecurityCard”. When a new person is born, the government makes a transaction with this smart contract, and assigns your Ethereum address a social security number like in the image below.
In this case, each account has a single token (their social security number) and none of them are interchangeable. This is a horrible idea in terms of privacy. NEVER place any personal or confidential information on any blockchain.
You’ll often see NFT’s being marketed as images. This is not correct, and the image itself is not the NFT. Instead the smart contract holds at least two pieces of information: a website where the picture is uploaded to the internet, and an account number for the person that purchased it. Anyone buying an NFT of an image simply paid to get their account number attached to a piece of code in Ethereum, much like the account numbers are attached to social security numbers in the previous example.
Recall from the allowance example, that our child has 20 FakeBux, they can redeem these to buy something. In other words, we will turn their FakeBux into USD (or whatever currency you use in your home country). But let’s say our child is very good at saving, and doesn’t spend any of their FakeBux their entire childhood. Suddenly, a day before they turn 18, they ask to redeem every single FakeBux for USD. They had saved up 10,000 FakeBux, meaning we owe them $10,000. Uh oh.
We should have made sure we had at least as many dollars as we had outstanding FakeBux, and this is how stablecoins work. You’ll pay real USD to a company, and they hold these dollars in a bank account. In return, they add that exact amount of stablecoin to your account in their own smart contract. This is not very useful on it’s own, but if many, many people start buying this stablecoin, it could end up being useful.
Imagine FakeBux being used by all the kids in our child’s school, not just our children. Our child wants candy, but knows we wouldn’t allow them to buy it. However, they have a friend Billy, and Billy’s parents don’t care what he eats, so they fill his entire lunch box to the brim with candy every day. Billy really wants a new bike but doesn’t have enough FakeBux to buy one, so he decides he’ll start trading his candy to other kids for their FakeBux. The kids send commands to the FakeBux smart contract to send their FakeBux to Billy’s address, and in return Billy gives the kids candy.
We created FakeBux to prevent them from buying candy, but because a source of candy is now happy to take FakeBux, our plan has been foiled. Successful stablecoins have managed to get enough people to accept them, that they’ve now taken a similar role to the hypothetical FakeBux. If a cryptocurrency exchange knows they can redeem a stablecoin for USD, they are happy to accept that stablecoin in exchange for bitcoin or ether. It’s just as good as cash at that point.
But what’s the point? We said “it’s just as good as cash”, so why not just use cash? Cash has one major problem: it’s connected to the centralized banking structure. If you use cash to purchase bitcoin, the bank knows you just spent money on cryptocurrencies. Sell that bitcoin for USD and then buy ether? The bank knows that too now. Not to mention the taxes, regulation, oversight, etc. all tied to cash. But stablecoins have almost none of that, and allows you a single point of entry. By using stablecoins you can purchase cryptocurrencies once with cash, and then buy bitcoin using the stablecoin without anyone knowing, tracking, or taxing you. If you decide you’d rather own ether, you can sell your bitcoin for stablecoin and then use the stable coin to purchase ether. All without the banks or government knowing a thing, or taxing you a dime. Finally, at the end of the day you are confident you can redeem those stablecoins 1-to-1 for USD.
At this point it should be clear now how interconnected each of these innovations are. They’re virtually all a different flavor of smart contract, and those themselves are just a program. This is obviously a very high-level overview of Ethereum, but in the future I will dive deeper into some of the finer details. Some of these topics will include: What happens when stablecoins aren’t backed? What happens when a smart contract is flawed? What are you actually buying when you purchase an NFT? And what happens when Ethereum gas prices go sky high?