MetaMask - The Web3 starter kit.

(Portuguese Google translation here)

Estimated reading time: 21 min Level: Introduction+++

“Crypto assets“, Blockchain, NTFs, Metaverse, etc., are making headline news. If you’ve been wondering about them, what they mean, their function and how will start affecting your life style, well… this is a good place to start.

I humbly aim to give you an overview of the “Crypto World”, demystify the subject and initiate you on some practical application.

I recently devised a special gift, for a limited amount of people, celebrating a “one time event” in my life. Rare enough, but worthless because I’m not Elvis.

The gift was special in two aspects: the meaning and the medium… POAP, a crypto asset… It immediately raised two barriers (and a few eyebrows): Trust and Knowledge.

All this started as an attempt to write a few words as a “Lazy guide”, half a page, I though… need a big pic to fill the rest… Read that “half page” below…..

Fasten the seatbelt… going down the rabbit hole!

NFTs, Metaverse and others terms like P2E, Defi, DAOs, etc., will not be touched upon here, but for sure dealt with latter, just stay tuned.

We will start our journey around MetaMask and Ethereum (ETH). What are these?

MetaMask is a crypto wallet. A crypto wallet is a digital passport that allows you to e.g. store and transfer cryptocurrencies, collect NFTs on the blockchain (“on chain”), in short sign Smart Contracts. It doesn’t store anything apart from Keys, should be called keyring instead of wallet. Your “wallet” creates and stores two identifiers: (1) a public key and (2) a private key:

(1) The public key is the wallet address that other people may use to send you transactions.

(2) The private key is like your password, which you can use to sign actions from your wallet.

Note: Your wallet can only be controlled by using your private keys. This is how you interact with the web3.               “Not your keys not your assets”

Ethereum is one of the most popular “Crypto Coins” maybe only losing to Bitcoin. ETH is the native token used for all transactions on the network.

We will also dive into Bitcoin inception to understand the “why’s, who’s and when’s” of this legend.

Going down…

To understand MetaMask and Ethereum (Tools and Crypto) it’s advisable to have an idea of what is the web2.0 vs web3.0 as concepts and their main differences.

The term web2.0 basically represents an evolved version of the initial internet with fixed pages (web1.0). Today’s collaborative environment, with many other services on top i.e. a read/write environment is represented by the term 2.0. That’s even argued amongst some enthusiasts that, given then numerous changes made, claim that the number should be higher. For our purpose its not an issue.

Today there are several P2P applications (Peer-to-Peer i.e., one user directly to the other) mostly on file distribution, but in fact, the majority of the traffic depends on servers (centralized and controlled by an entity e.g., google, Facebook, Netflix, Banks, etc) and therefore, centralized (CEX).

On the web3 decentralization (DEX) is the standard as opposed to centralized (CEX).

· web1.0, we could act as a provider (server) or reader (browser) but one at a time, the old read-only pages. · web2.0, we all contribute and read, consume services, etc., but based mostly on centralized entities, we are only a user/login and don’t control the data or service. It can be stopped or changed autocratically at any time. · web3.0, we all become “servers” i.e., we control our data and identity, services cannot be stopped or changed at will by a centralized organization, only by the community involved.

Web2.0 still contains all the web1.0 characteristics, similarly in the web3 environment we still have web2.0 presence, a spectrum of DEX vs CEX, and that’s why Ethereum is a good example for this article – better than Bitcoin in my opinion, the most popular/hated “kid in the Block”.

Ethereum, being a service driven blockchain, attracts interest in areas like gaming.

A common P2E (Play to Earn) environment has an ecosystem maintained by a central organization, but the items used, bought and earned by players are kept and traded decentralized on a blockchain. This is one example where DEX meets CEX on the blockchain services. All gaming items will still exist on the blockchain after the service is shut down i.e., the server game. This will reward the participants long after the game ends and available for display, trade or just keep the items and trophies conquered.

Bitcoin the start…

Bitcoin (BTC) is a popular cryptocurrency and the result of over 50 years of development. The idea of "internet money" emerged with the growth of online business but the lack of a way to make payments over the internet.

In 1974 TCP/IP was implemented giving Internet the shape and capacity we still use today. I consider it a prehistory landmark on the blockchain history.

Cryptography, which evolved from the 1970s onwards, played a crucial role in the development of Bitcoin. The CypherPunks movement, composed of cryptography enthusiasts, aimed to protect privacy with its application and created a manifesto defending its usage as a mean to protect privacy.

“Privacy is not secrecy. A private matter is something one doesn’t want the whole world to know, but a secret matter is something one doesn’t want anybody to know Privacy is the power to selectively reveal oneself to the world.”

Cryptography was the bedrock on which Bitcoin evolved, leading to a “first” attempt to sign transactions anonymously back in 1983 and the innovations never stopped.

One of the names worth mentioning is Nick Szabo, a mysterious and genius character, inventor of the smart contracts concept and designer of Bit Gold, a precursor to Bitcoin.

Another person particularly interesting was Hal Finney, also a member of the Cyberpunks and the receiver of the 1st transaction done on Bitcoin (from Satoshi “himself”). Hal was not only very active during the initial days but had, in the past, done great practical and conceptual improvements to the solution. If he was the author of the “bitcoin white paper”, well… he died in 2014.

Satoshi only solved one problem – “*The Generals Byzantine fault”, *a governance model that allows non-trusted parties to agree. Consensus Algorithm in our case.

Hal’s work included a “coin” that could be used to avoid SPAM (follow the link for fun – the term was coined on this Monty Python movie).

The idea was the need to use a token for every email sent. The value was minimal, earnable and therefore not a barrier for a normal usage. However, it would require huge amounts to produce real SPAM.

The point of failure was a result of the “Copy/Paste” function brought by the digital world. It basically allows one to reproduce a digital item infinitely. This led to the impossibility of creating scarce digital items (or tokens in our case). Digital abundance makes all copies worthless, even the original. This is an aspect that is better explored with NFTs so we will park it here and resume it on another article.

And then Satoshi Nakamoto emerged. A person or a group? There are a lot of theories and the full history of the chats and emails exchanged between the members are available in some forums - for a latter reading a good and extensive history of Bitocoin with a loot of external references can be found here.

As a curiosity the term Blockchain was never mentioned by Satoshi, it was coined latter by the mainstream. Satoshi is also used as de denominator for the minimum part a BTC can be divided: 1 sat = 0.00000001 BTC, an homage to him I think…

The “Bitcoin: A Peer-to-Peer Electronic Cash System” by Satoshi Nakamoto proposed a solution that was discussed, implemented and lead us “where we are today”.

As all the crypto assets, Bitcoin architecture relies upon a “Consensus Algorithm” that allows all the participants to agree on the transaction to be included, propagate and store them (execution layer). The “storage part” is particularly important.

On a centralized system the ledger of all transactions (not necessarily financial) are stored and kept by a central organization. All rules, sanctions, fees, etc., are centrally governed.

Access to its records can also be denied and in fact records can be changed centrally.

Since blockchain allows untrusted parties to agree, we can now drop a centralized organization to keep the records and settle disputes. Technology plays a role since it would be impossible to have access to the “full world financial records” without it.

But that’s what Bitcoin proved. All the participants on the system (miners in Bitcoin case) are replacing the central entity and keep equal copies of the ledger. Most users won’t do mining and won’t be rewarded, but they will still be able to read  and write on the ledger at any time. Also very important, knowing the ledger is safe and maintained by many participants. It’s also a resilience factor to have the ledger replicated in so many servers: geographic redundancy on steroids – all miners have the full Blockchain file on their servers, in fact you don’t need to mine but simply have a server syncing.

The ones maintaining the Distributed Ledger (13965 miners at the time of writing) will look at the proposed transactions, pick the ones they like most (higher proposed fees, usually) and try to get the next block.

When the block is found and agreed on, everyone registers it on their ledger. To mine the next Bitcoin block you need to find the Hash of the previous block with a “difficulty” factor that varies according to the processing capacity available. It intends to keep every block at 10 min average independently of the processing capacity available to calculate the problem. These blocks are strongly connected by cryptographic keys like a chain giving origin to expression Blockchain.

The method by which they all agree (consensus) is actually very simple in principle. It’s only a “guessing” method. You have a statistical probability of guessing depending on your processing capacity.

Let’s look at a high lever model. Most people get lost on trying to understand the bolts and nuts missing the big picture. No one loses times trying to understand how a mobile works in detail, we just need high level models to understand the reality. Satoshi Nakamoto’s paper had only 9 pages, the last consisted of references and in all a lot of empty space. In those pages he fully explained the concepts.

The implementation is more complicated but helps understanding the concepts, we tend to learn better with practical examples…. So, let’s start with the ledger file, where all the information is stored.

Above we see a representation of the format the ledger file has. The ledger is stored on every miner’s server as a file. They use the file info to mine the next block, consequently getting rewarded and maintaining the system. Same principle, banks keep the system while there’s profit around.

We will ignore the genesis block (first and only one not preceded by one – Let’s call it “previous block”) and assume our example starts at the attempt to mine Block #2 cutting unnecessary and complex explanations.

The content of the block itself, mainly transactions to be included (and a few parameters), are picked up by the miner from the pool of pending ones (memory pool). Miners, as normal, prefer higher gas fees since they are part of their reward, the profit. The gas fees used vary according to the network usage. When there are a lot of transactions people tend to set higher rewards as an incentive to have their transactions processed earlier. Miners will always include transactions on the blocks, up to its capacity, so if you wait for a less congested time the fees needed will be less. In theory you can even send transaction for free, the easiest way is to be a miner and include transactions on self-mined blocks.

On the top of the rewards there’s also a block reward, a fee you receive for creating the block – more below.

But all the above glory only comes approximately every 10 min and the winner takes all (or 1 entity representing a pool of people). But how does it work?

Let’s take the role of the miner as an abstract entity. This entity is going to start a race against the rest of the “world”. The race consists in trying to guess a certain string that follows a few rules. One is that the result has a fixed number of characters, another that it starts with an initial number of zeros - to set the difficulty.

The previous block content is used as part of the input. When someone finds one solution to the problem, he wins the race.

Before we continue let’s look at the picture again.

We have Block #1 and we needed to find the its “Hash”, this allows the creation of the next block, a cryptographic key that keeps a chain of blocks strongly connected… Blockchain.

And that’s exactly what every miner is trying to do, find the Hash of the last known block to be able mine the next one and get the rewarded.

A hash function is the solution since it allows you to get a predefined number of characters as an output using any random size as input.

There are 3 other characteristics important to note on the hash algorithm, its fast, not reversible and seems completely random. To illustrate the “randomness” statement. A text composed by a billion letters would change completely the result if you “change a coma”.

Bitcoin uses SHA256 - a few made up cases below to illustrate. Use this simulating tool to understand.

It’s a “simple” but intensive process called PoW (Proof of Work) because it’s a trial-and-error problem. As in normal gold mining, heavy hardware and energy is needed to perform the task.

Let’s get back to the point where only Block #1 was available.

Every miner will start to solve the problem by calculating Hash values. At rate their processing capacity allows, the sum of all Hash Rate available is used to set the difficulty factor – several initial zeros on the result – This is a statistical average value and Bitcoin measures time in Block Height – current block number (we assume 10 min). The adjustment takes place, on average, every 2 weeks (or 2016 blocks) Use this link for some info

Since the result of the previous block has only one solution, we need to introduce an extra value to calculate a result with x initial zeros. We call it Nonce and it’s basically a value appended on the block info that miners keep changing to derive a valid solution… a pure trial and error process.

The one with the bigger “calculator” and enough power will have more chances to win.

Using the link above you can try as done below.

Using as input: "This is the block content" (inverted comas included) you will get as output: 8b181dec2f1e09d30c0cca7554e04d2524d6ea40b59c5a525733560c757fa0c2

Try a difficulty factor of 1 (one initial zero) by adding a “Nonce” made up by you to get a correct answer - 2 answers below:

Input: 99999"This is the block content"      Output:      0b6480e38798c6607fc00d1a7cf3bf3f305ee3fb5660048f625bd8da1c0ae21b

Input: 11111"This is the block content"      Output:      090e4e904e7ec3a4d781d503d539250be09c74ee177b1eb64be42d3f2443e2c8

With this simple example, we got to understand the race to mine the next block. The solution found will be used to mine a valid block (including the transactions chosen to be processed) and get the correspondent block reward.

You may have asked… can we get 2 solutions for the same problem?

Exactly, remember that we guarantee than any input will have a unique solution with a constant format, only that. There are other inputs than have the same solution.

That is an obvious fact, the number of combinations for the input are infinite, the result is huge but finite in combination. We don’t use an infinite number of combinations in real life but also a predefined format, nevertheless collisions still happen.

That adds up to the statistical problem of 2 miners finding a valid solution at the same time and propagating 2 different and valid blocks. “Same time” is relative since we are talking about a distributed network and information transmission has delays. But we do have our 10 min average between blocks, an eternity on the digital world.

What happens in fact is that 2 different paths will be built at the same time but only one will survive.

Some miners will see block C first and will start working on the Hash to mine the next block, others will see block C’ first. Eventually all will receive both blocks and will have something as shown in the pic above. Every miner will always work on the longest known chain, otherwise they will waist the work done. The short path will be removed at some point since all miners will eventually sync to the longest one.

This mechanism (called confirmations) can be seen online. The number of confirmations is the number of blocks already produced on top – after the one we had our transaction processed. We call follow the confirmations on chain and it changes every 10 minutes. 6 confirmations is the rule of thumb to consider it non-reversible, the 60 minutes it takes to fully transfer BTC. However, most apps will show the progress and even let you decide the number of confirmations you feel comfortable with.

You could eventually win the race if you had most of the capacity and therefore outrun the rest of the world. The figures are higher but for the example let’s use 51%, which is the name of the theoretical attack.

Imagine you have more than 51% of the Bitcoin mining capacity, that gives you statistically 51% of the mining rewards and fees. You will have more that 1 block in every 2. If you get 75% it’s 3 out of 4 blocks…. Meaning you could dedicate time to rewrite past blocks while outrunning the others on rebuilding a longer path.  This is of course a theoretical example only possible on small networks. The amount of investment and work to accomplish that in Bitcoin is insane and the only result would be the end of trust in Bitcoin and thus it’s collapse. It’s like buying a luxury condo to demolish it.

The block reward is what brings all BTC into existence. The first block originated 50 BTC to the lucky miner and so on for the subsequent. That meant we were getting 50 coins every 10 min.

However, Bitcoin is programmed to halve the rewards approximately every 4 years (or 210,000 blocks). The protocol security, the fact that there will only be 21 million and the above is what makes it a store of value i.e., has the needed characteristic.

On the above graph we see the blue curve representing the available BTC at any time. An initial high supply but cut in half every 4 years and ending supply in 2140.

In fact, the yield (production rate) of BTC if not already lower than gold will be in the next halving (2024), making it rarer.

We have so far explored the inception of Bitcoin and therefore the blockchain concepts and architecture. There’s much more, and more detail, but for now this should be enough. Other protocols have their specificities, but the principles are the same.

Bitcoin and the Crypto Evil

Before moving on I would like to just touch upon some aspects that are making headlines from time to time.  Some deserve discussion others are just noise. I’m not qualified to discuss any of them as an expert. However, we all can give some thought to subjects instead of just listening, we can than make some educated choices (mostly guesses, but…).

Energy Consumption - True, it’s high in Computing Hardware and Energy consumption. I know, I used to mine ETH and let’s just say the winters didn’t seem so cold. The expression mining it’s on purpose. It’s like digging, digging, digging… and eventually get lucky. On a modern view is heavy hardware and a lot of energy like gold mining.

Do we question the real mining activity besides not waiting it in our yard? it’s needed to produce batteries and other and other essential technology for our “eco” EVs. I’m not dismissing the issue but there is no point in the comparisons usually done. One I’ve read compared the Bitcoin consumption with a country, another said it represents only a small percentage of the US banking system. The first is for sure more accurate than the second… probably skewed to be Bitcpoin bias. However if any comparison should be made I wold prefer a real and honest report on that. I prefer to do the analysis differently.

Energy consumption is (inefficient aside) synonyms of a developed society. We usually never question the usage of the energy for anything but only cost/benefit. It’s ultimately an economic decision every person plays every day.

We must question the utility of Bitcoin instead of dismissing it. The problem of the energy consumption is mainly on the source and renewable energy plays a doble role here.

A big number of miners are using renewal energy. Some because it’s cheaper or close to nothing where they live (e.g., Finland) other because they are environmentally conscious. The fact is that mining is not profitable if you don’t have a low-cost energy source.

But then Renewable Energy Producers are also turning Bitcoin into a “monetary battery”. Renewable Energy is either used immediately, stored in batteries (expensive) or “burned”. With up to 20% waste some companies already invested in mining activities and using the, otherwise wasted energy, to mine BTC and get value store as a crypto asset…

The expression “Energy consumption is the thickness of the Bitcoin vault” symbolizes that the Bitcoin is secured on processing power (associated with energy consumption) – as opposite to buildings, guards, etc.

Unlike normal mining, where heavy machinery will always be used, Bitcoin mining uses energy only for calculations, the energy needed per procession unit is always decreasing so Bitcoin will also follow the normal trends on efficiency.

Bitcon is used by criminals – Criminals are regular people, they use everything. But if they also use their Brain, crypto is the last place they would commit crime… I know, some are dumb enough to try it.

A criminal mind should be worried about not leaving clues and hope that inevitable ones get cold soon. Blockchain is immutable, public and readable by anyone, the complete opposite – complete transparency, not even “Justice secret” is possible.

The fact that you sit behind a pseudo anonymous identity is only valid while no transaction with others is done. The usage of private protocols is just a barrier, there’s always time, all the records are available “forever”.

Imagine you hack into an account and transfer BTCs to a newly created wallet. All you could do was watch it. Any movement could be traced by the rightful owner if not the police. Trying to cash it out would imply using a bank as gateway (KYC applies), selling directly to someone will disclose info to someone that will eventually fall into KYC also.

Really, bank transfers and money bags are much easier to deal with, especially since most Mafia Houses haven’t developed the IT department to the needed extent.

Bitcoin it’s a Ponzi Scheme: Ponzi schemes are scams in which fraudsters use money from new investors to pay rewards to the existing ones, without ever generating any revenue. I hope the above explanations have prove that it is a serious protocol, it’s usage may be arguable but that’s people nature.

A fun but relevant fact, Gary Gensler the current Chair of the SEC (Securities and Exchange Commission) has previously lectured an open course about blockchain in MIT. At a certain point he’s explaining that the Bitcoin ledger follows the same rules of any double entry ledger used on central banks.  And then, when comparing BTC and Fiat governance (Eur, Usd, etc) a student, referring to the USD says… “But that’s a Ponzi scheme!”, Gary laughs…

The reason there is fraud with crypto is only one: Crypto exists. And it has all the properties for it. It’s unknow to most people and it’s been associated with high profits. Apart from that it’s like any other asset. Gullible, naive and greedy people will always be fooled with scams. Safer to stay informed, keep reading 😊

ETH the accelerator and Metamask

Then in 2017 Vitalik Buterin decided to use the Bitcoin blueprint and create a new mainchain - Ethereum - and its token ETH. If BTC showcased Blockchain to the world ETH was probably the reason the ecosystem exploded.

Ethereum took the programable part of BTC and expanded its capacity to build what is in fact a decentralized computer, therefore applications that are decentralized (DAPPs)

The way we use Ethereum is, in essence, the way we use a computer. Only the interfaces are still not on the same standard. We can say they are still on the level we had IRC chats over the telephone lines but evolving at a great speed.

MetaMask is one tool that allows you to create, store and use a web3 identity. It’s only a needed human interface, like your web browser that helps you read pages without having to send commands directly and interpret the results.

When properly installed and used poses no risks to the user. Not even your identity is revealed, there is no need to communicate with the “outside world” to generate your address. How is that possible?

In a centralized organization we get any new member addition by providing a number, usually sequential but always non-duplicated. Someone keeps check on the next available or at least the used ones.

So, how do we get a web3 address? We make it up…

There are rules for a creation of an ETH address, if those rules are followed you have found “your” address. The method relies in using a 64 Hex character random string as a private key and then derive the public address applying Elliptic Curve Digital Signature Algorithm as an initial step, this is impossible to reverse i.e. we can easily reproduce the result but cannot guess the input by the output.

You may see some resemblance with the HASH256 explained on the BTC since all blockchains are based on cryptography.

The number of possible addresses is so big that it’s statistically impossible to get a match. The trick relies on having true random data as input. And that’s all MetaMask does initially, generates the needed random data and derives the key and address – no external communication needed.

You may even do it yourself by applying the mathematical concept.

If have installed the MetaMask tool and created a wallet, you now have a public address which can be seen in the app and shared. You have set up a password but that only gives you access to the installation you have done – you can lose it without much danger given that you kept the 12 words (seed words) safe – you may also retrieve it from the APP, but now you need the password.

Those words (or the 2 first letters of each) are a humanized way of storing what is needed to reproduce your keys.

So, in fact MetaMask is not a wallet, there are no wallets. The wallet is the blockchain itself. They just store keys…

Before you share your address to anyone no one really knows who that account belongs to, even if assets are transferred to it. If you share it among a private network, you will still be anonymous to the general public.

It’s when you start crossing funds across (buying or selling) that KYC (Know Your Customer) applies. In most cases this is just a customer database/legal obligation. On other cases, like exchanges, it may have fiscal implications (or legal) depending on which jurisdiction you live and the asset in question.

But this article is not about speculative side of blockchain and the main take away, apart from some basic understanding of the ecosystem, is that anyone can start using it for the sake of education.

There is already a “digital divide” that is considered a new way of illiteracy. I’m afraid blockchain will create the next wave given the fears imposed on people by the media.

If you come this far then get to it! Install MetaMask and ask for your first “gift” along with a new lesson to deal with it. Get help here.

This will probably be your first “Crypto Asset” (a POAP, a special type of NFT…. We will get there).

Send an email to hanon@dmail.ai and receive a link to redeem you Proof of Attendance and Participation (POAP) as a (soft)Diploma for reading and “executing” this article.

If you want to try DexEmail (dmail) please use my invitation.

The boring part below…

<cover: AI design> <text: H + collaborations, rewarded here> <Images: Stolen with pride, no collaborations proposed>

Acknowledgements: To my daughter for her “young view” on the subjects

Thanks for reading, H

 
Subscribe to Block-chaining my thoughts
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.