I Learned About Cryptocurrency By Creating My Own
TLDR; I endeavor to explain blockchain & cryptocurrency in simple terms. Then for the fun of it, create a cryptocurrency of my own.
Ever since I joined a cryptocurrency company, I have been asked so many questions. "What is Bitcoin?" "How does it work?" "How do you even price Bitcoin?" These are the most common questions I get asked from friends and family.
I think one of the biggest problems is that the people who actually understand the subject, enjoy talking about it in mumbo jumbo computer sciencey finance garble. When I first started exploring the subject, I went to blockchain/bitcoin meetup and I went out of there even more confused than before. Undeterred, as a visual learner, I decided to watch a ton of youtube videos on the subject.
Let's learn about blockchain!
Let's watch this expert on youtube attempt to explain it in 5 levels of difficulty.
Actually, wait, after listening to all five explanations, I still didn't understand what a blockchain is.
It took me a whole bunch of videos and going through some articles before I got a grasp of the subject. Here are some of my favorite resources, check out this visual article from Reuters or this article from Crypto.com University.
Here's how I like to explain it: Just think of it as a Google document. More specifically, like a Google sheet. A blockchain is like a Google sheet without Google. ("decentralised") This sheet contains information about transactions ("blocks") that have occurred by people using the sheet. Let's think of each transaction as a single row on the sheet. Like a Google sheet, everyone sees one single sheet at any given time. ("distributed ledger") Each time someone wants to add a new transaction, users ("nodes") must collectively approve of the transaction and become permanent. ("consensus") This is a very, very basic explanation of a blockchain.
Here's how an actual blockchain looks like. The Bitcoin blockchain is the most popular and famous one.
What's the point of a blockchain then?
Think of a time where Google documents didn't exist. You'll need to go back and forth to confirm the document changes. Think about how many emails you'll need to send because everyone has a different copy. Someone can also change their copy and redistribute it under your name for malicious intents. With blockchain, transactions between parties are verifiable and permanent. In a nutshell, Blockchain makes operations more accurate, efficient and secure.
Wait, so what's cryptocurrency?
Cryptocurrency refers to a digital currency - a medium of exchange, like bitcoin(?). Bitcoin blockchain logs transactions of the currency. To illustrate this, let's expand on the earlier example, the people who are approving a new transaction can get a reward in the form of cryptocurrency, bitcoin, in this case, for their work. (We now call these "nodes" as "miners") There are two parts to this reward, a "block" reward and a transaction fee.
Not all blockchains are created equal
In the case of bitcoin, there's a fixed global supply of 21 million bitcoins. A block reward is when new coins are released from the global supply and transaction rewards are paid by the party making the transaction to miners - the faster you want your transaction to be approved, the more you pay for your transaction fee. The approval process here involves a competition to solve a mathematical puzzle. This is known as a "proof-of-work" blockchain.
Okay, what happens when supply runs out? "Block" rewards are not compulsory. Let's examine another type of blockchain, where there can be no "block" rewards. Instead, to add a new "block", you need "nodes" that total up to half the total global supply to validate your transaction. (These "nodes" are called "validators") The nodes who participate get your transaction fee based on how much supply of the token they hold. ("stake") This is a "proof-of-stake" blockchain.
Enter Ethereum and smart contracts
Okay, what about the Ethereum blockchain? Here's Vitalik Buterin, creator of Ethereum explaining his blockchain. In a nutshell, instead of bitcoin, ether is the main token on the Ethereum blockchain. We can think of the Ethereum blockchain itself like a giant computer and allows for the use of "smart contracts". A smart contract facilitates, verifies and enforces transactions. What this allows us to do is to create applications ("DApps") that allow us to verify other forms of transactions beyond just cryptocurrency transactions.
To better understand this, I decided to write my first smart contract on Ethereum that defines a new cryptocurrency.
To start, I have set up an Ethereum wallet - Metamask. Metamask is a wallet that can be installed on your browser and stores Ethereum.
In my experiment, I will be using the Ropsten Ethereum ( “Ethereum Testnet") which is used for testing purposes. Ropsten Ethereum is free.
Writing the contact
Smart contracts on Ethereum are written in a language called Solidity, which is completely foreign to me. To speed things up, I followed the easiest tutorial I could find - which already has a contract written and involves only 3 variables - the token name and symbol and the supply. Due to a lack of creativity, I simply went with Victor's Test Token (VTT) and set the token supply at 100,000.
Here is how the contract looks like;
pragma solidity ^0.4.18; contract VTTCoin { //Coin name string public name = "VictorsTestToken"; ///Symbol string public symbol = "VTT"; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply = 100000; function VTTCoin(){ balances[msg.sender] = totalSupply; } function transfer(address _to, uint256 _value) returns (bool success) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
Just like that, I deployed my first ever smart contract via Remix (an integrated development environment for Solidity - just think of it an online editor for now) to find my very own 100,000 VTT in my Metamask wallet.
To test if VTT really exists, I set up another Metamask wallet on another browser on another computer and proceeded to send 100 VTT to another wallet and it worked. You can even see the contract and transactions on the explorer itself.
This smart contract is an "ERC-20" contract, which is a standardized contract for most tokens on the Ethereum blockchain. It basically defines 6 standard functions and the 3 variables mentioned earlier.
- totalSupply (defines total supply of tokens created)
- balanceOf (shows the number of tokens held in a given wallet)
- transfer (determines how many tokens can be transferred from the total token supply to a user wallet)
- transferFrom (allows users to transfer tokens to other users)
- approve (checks transactions against the total token supply - prevents counterfeiting and fraud by verifying that transactions don’t increase or decrease total token supply)
- allowance (checks individual wallets and cancels transactions if wallet funds are insufficient)
I was surprised that drafting and understanding this contract took less than an hour and I've learned so much about the underlying technology behind bitcoin. I've also discovered that you can literally view the smart contracts of the tokens created on the Ethereum blockchain, a notable example would be Tether, (USDT), which is a token that is pegged to the US dollar. (a "Stablecoin")
Okay, now we have our own digital currency. What's the point?
VTT needs value. I, therefore, declare that if you pay me one VTT, you can get a hug from me. Now the value of one VTT is a hug from me. This is an example of a utility token. You can now take VTT and go to a cryptocurrency exchange, and exchange this token for another token that does something else or straight up redeem it for cash. The act of doing so for the first time in a public setting will be known as an ICO, initial coin offering. If this is done so on an exchange, it will be known as an IEO, initial exchange offering.
Imagine if instead of being able to redeem the service of a hug from me, I now declare VTT to represent a share of a company. Now VTT bears the properties of an investment instrument. This is an example of a security token. The act of doing so for the first time in a public setting will be known as an STO, security token offering.
The rules and regulations governing the sale and usage of these two tokens vary greatly and differ between countries and jurisdictions.
There are many, many factors determining the value of a cryptocurrency. Here are just a few discussed.
- How the token is being used
- The supply of cryptocurrency and market demand for it
- The rewards issued to nodes for verifying transactions to the blockchain
- Regulations governing its sale
Now, who wants some of my extremely pointless VTT?
About
I'm currently Marketing Associate at a leading global Fintech. I'm also Marketing Lead (on my free time) at CareerSocius, a social enterprise in Singapore aimed to provide affordable, quality personal branding services. Got an idea? Reach me at hello(at)victorx.space
Disclaimer
The views, thoughts, and opinions expressed in the text belong solely to the author, and not the author’s employer, organization, committee or other group or individual.
Love it Victor!