DEV Community

Cover image for Blockchain 101 (and the protocols that use it)
Angie Jones
Angie Jones

Posted on • Updated on • Originally published at angiejones.tech

Blockchain 101 (and the protocols that use it)

Lately, I'm hearing a lot about crypto, blockchain, bitcoin, Ethereum, smart contracts, defi (decentralized finance), dapps (decentralized applications), DAOs (decentralized autonomous organizations), NFTs (non-fungible tokens), web3, and on and on.

I wanted to learn more about all of this stuff so I started digging around for tutorials. I found myself pausing each one shortly after starting because they all seemed to assume I had even the slightest clue as to what some of this means. I got particularly confused because they'd call it a beginners guide and yet reference some of the other terms as if I already knew what they meant. Reader, I did not know!

Eventually, I found a wonderful tutorial on Free Code Camp. This video tutorial is 16 hours long, so this will probably be a series of blog posts.

Here are my notes on the concepts - from an absolute complete beginner's perspective.

What's the Purpose

It's difficult to grasp new concepts when you don't know what they are used for, so let's start here.

Physical currency and the way we spend it is governed by entities such as country leaders, banks, and other financial institutions. A couple of recent cases that come to mind are with Robinhood and OnlyFans.

Robinhood haulted buying of GameStop shares (at least for some people) after a coordinated effort of Reddit users caused the value of the shares to skyrocket. While Robinhood's move infuriated a lot of people, there wasn't much they could do because Robinhood governs who can buy and sell what on their platform.

OnlyFans announced they were banning sexual content after mounting pressure from payment providers such as Visa and Mastercard. Because of the power of these financial institutions, the company feels forced to play by their rules or lose the ability to accept these forms of payments.

There have also been many instances where banks prevent withdrawing your own money for various reasons, or hold deposits before allowing you access.

A decentralized network that is not controlled by individual entities addresses these concerns. With decentralized networks, we get transparency, freedom, and security.

Blockchain

The starting point is blockchain - a type of database that stores information in individual blocks that are chained together.

A blockchain is shared across many computers (known as nodes), so there's no single record, but rather multiple copies of the record - making it almost impossible to hack. All of these records are visible to everyone.

Unlike traditional databases, blocks within the blockchain are immutable, which means they cannot be changed. So when something is written onto the blockchain, it serves as a permanent record.

When new data needs to be added to the blockchain, it must be written in a new block and then chained together to the last block. The blocks are in sequential order.

Because blockchain is decentralized, there is no central governance controlling what can and cannot occur.

Bitcoin

Bitcoin is one of the first protocols to use blockchain. It is a cryptocurrency (I'm thinking of it as "digital money") used in peer to peer transactions in a decentralized network to buy and sell things. Records of all of these transactions are stored on the blockchain.

But just because it's digital doesn't mean there's an infinite amount of it. There is a finite amount of bitcoin, just like with physical money.

Ethereum

Ethereum is another blockchain protocol. The cryptocurrency of this protocol is called Ether (ETH).

Ethereum takes its use of blockchain a step further than bitcoin. With Ethereum, you're not just limited to decentralized currency, but it enables people to build decentralized applications (also known as dapps) and decentralized organizations (also known as DAOs).

Ethereum is not the only advanced protocol utilizing blockchain, but it is by far the most popular.

Ethereum is turing-complete which means we can also program anything with it! These programs are known as smart contracts.

Smart Contracts

Smart contracts are code that describe an agreement between parties and executes the terms of that agreement on its own. Smart contracts execute on a blockchain. On Ethereum, smart contracts are coded in the Solidity programming language.

What's great about smart contracts is that trust between parties is not required. The terms and conditions are coded and automatically executed, so you don't have to worry about the other party (e.g., insurance company) not holding up their end of the bargain.

This is one of the main advantages of the Ethereum protocol over the Bitcoin protocol. Bitcoin also has smart contracts, however, by design, they are not turing-complete - meaning they aren't capable of the wide range of functionality possible with Ethereum. Bitcoin is viewed more as an asset whereas Ethereum is an asset as well as a platform to build smart contracts.

What happens in blockchain stays in blockchain (this concept is also known as on-chain), which poses a problem for smart contracts that need to access outside data or computations. Blockchain Oracles solve this.

Oracles are able to perform computations and provide information to smart contracts on the blockchain. But because oracles are external to the blockchain, we need to make sure the data they are providing is decentralized before sending it to the blockchain.

Chainlink is a decentralized oracle network (the most popular one) that will facilitate the transfer of the external data onto the blockchain, ensuring that it is clean. Smart contracts that use external data are technically known as hybrid smart contracts, but this term is interchangeable with smart contracts. If someone explicitly says "hybrid smart contract" they are intentionally pointing out the fact that external data (off-chain) was used. Chainlink can be used with any of the blockchain and smart contract platforms, not just Ethereum.

Dapps are decentralized applications that typically comprise of multiple smart contracts.

Ok, that's what I know for now. Stay tuned as I learn more.

Discussion (18)

Collapse
lyle profile image
Lyle Troxell

This is an absolutely wonderful compleat and concise write up, I plan to send this to others. Thank you.

I’ve covered crypto and coin for a while on my tech podcast (I think our first episode on it was in 2013). And I was bullish early on.
But lately my take is that there is too much waste and miss-aligned incentives to get much good (for society/people) out of the blockChain tech at this time.

I’m looking forward to your upcoming posts on this.

Collapse
hammertoe profile image
Matt Hamilton • Edited

Angie, this is a great primer. I know when I started in machine learning I was in the same situation. Every post assumed I knew the terminology, most of it statistics based (What the hell is "regression"?!). That is actually what got me into DevRel in the first place, trying to answer the question "What would I need to know as a developer new to ML?".

As for blockchains, another good one to look at is the XRP Ledger, which was the 2nd major blockchain after Bitcoin. It was designed to be "bitcoin but without the energy requirement of proof of work", and thus uses a much more efficient consensus protocol. One of the key features that the XRP Ledger brought to the field was a decentralised exchange (or "DEX") which allows you to trade one asset with another on-chain, without needing to use a centralised exchange (like Coinbase). So again, you get the benefit of no-one can tell you whether you can or can't trade.

And to go with that DEX it also was the first blockchain to allow tokenisation of other assets, e.g. USD, EUR, CNY, BTC, Gold, airline miles, art, etc. Fiat-pegged stablecoins are often referred to as "stablecoins" (as their value is stable against the fiat currency, e.g. USD or EUR). Tokenising other cryptocurrencies on another blockchain is often referred to as "wrapping" them, as some blockchains require the use of a smart contract to keep track of balances.

Put this all together and you have the basis of the "Internet of Value", the ability to universally move "money" from A to B. Regardless of the form that takes. I can pay you 100 USD but fund that payment with EUR and the XRP Ledger will automatically exchange it from one currency to another as part of the payment.

You can find more info about the XRP Ledger at xrpl.org/

Collapse
mangocat profile image
Mango Cat

This is a great start, but beware of leaps of faith like: "With decentralized networks, we get transparency, freedom, and security.". To some extent, proof of work (Bitcoin and similar) has delivered on this promise, but at an extremely high price in energy. Proof of stake promises to slash the energy costs, but puts control explicitly in the hands of the majority currency holders who likely won't abuse that power, at first....

Collapse
techgirl1908 profile image
Angie Jones Author

so those are cons but they don't negate transparency, freedom, or security. these things just come at a cost. right?

Collapse
mangocat profile image
Mango Cat

The enthusiasm for the money (some) people are making on Bitcoin has completely overshadowed the tremendous energy cost. At least the public discourse is starting to acknowledge it recently, but it has been a huge problem since 2013, inherent in the same system that made Bitcoin popular in the first place.

Transparency is true, even if some coins like Monero attempt to claim anonymity - simply using Monero and similar coins marks you as suspicious, just like showing up to a Pawn shop carrying a stereo recently ripped out of a car. Transparency in blockchain is (IMO) a great thing, but it is also radically revealing as compared to cash. Every transaction, ever, recorded permanently and irrefutably. I don't think the radical difference of that from the current status quo has really sunk in for a lot of the enthusiasts. Visa and MasterCard track you, but not like cryptocurrency does, and their records aren't open to the public all over the planet.

Freedom, lasts as long as government says it does. Ask China. Once cryptocurrency is criminalized, only criminals will use cryptocurrency. Sure, it will be hard - maybe even impossible - to stop people from using cryptocurrency, but there is a huge difference between open trade sanctioned by law enforcement and underground black market usage.

Security... I'm not 100% sold on this one, either. You may think the government can't seize your cryptowallet. Wait 10-20 years and see what all they can do. In a proof of stake world, where governments hold majority stake in the major cryptocurrencies, they can pull all the same levers they pull today - even faster and easier - in terms of freezing of assets.

Thread Thread
hammertoe profile image
Matt Hamilton

There is always the $5 wrench attack. And governments can always legislate to make your life uncomfortable if they want.

Thread Thread
mangocat profile image
Mango Cat

Believing they won't is naive. The large centralized ( don't kid yourself, Bitcoin, Ethereum, Ripple, etc. are easy targets for legislation, if not physical seizure ) value chains are targets for regulation.

Thread Thread
hammertoe profile image
Matt Hamilton

Indeed. Despite the actual blockchains like the XRP Ledger being decentralised and near impossible to seize funds from, if I get chucked in jail and told my only way out is to give up my private key....

Collapse
javier123454321 profile image
Javier Gonzalez

Lol Angie, you open up a can of worms once you make any content related to cryptocurrencies, everyone and their mothers want you to do a deep dive into the specific token which they wish to accrue in value. Thank you for the primer, good to see other (traditional) developers in this space. By the way, one other thing that is awesome in crypto, smart contracts are almost exclusively written in a TDD way, just the nature of the beast.

Collapse
techgirl1908 profile image
Angie Jones Author

TDD you say??? wow, I'm intrigued

Collapse
brpaz profile image
Bruno Paz

Very well written Angie. Thank you!
For someone like me who is also getting the first steps into understanding all the technology and concepts behind crypto/web3 , this is really usefull.

I never really had much interest into this until few days ago, but as I dive deeper, I am finding that there are really cool projects being done on this space.

I recommend everyone to keep an open mind ;)

Collapse
eke profile image
Eke Victor

Overcomplicated tutorials and these assumptions is probably the reason I haven't picked much interest in web3 and blockchain technology.

Great article @techgirl1908 , thanks for explaining this in detail. 💯

Collapse
darkwiiplayer profile image
DarkWiiPlayer

Nice article; but I'm a bit sad that there's not a single mention of git :D

Collapse
techgirl1908 profile image
Angie Jones Author

where does git fit into this?

Collapse
hammertoe profile image
Matt Hamilton

In some ways git is one of the original blockchains. Think about how commits are stored and referenced.

Thread Thread
darkwiiplayer profile image
DarkWiiPlayer

Exactly this. Git stores commits as hashed blocks, and each commit has a reference to the hash of its parent commit.

Collapse
talk2coded profile image
Emmanuel Steve

Nice read 👏👏

Collapse
siawayforward profile image
Sia

This was as nice as a convo with you Angie! I have pinned it because there are so many rabbit holes to revisit. Thanks for making this less intimidating to start learning 🤩