<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by 0xNazu.sol on Medium]]></title>
        <description><![CDATA[Stories by 0xNazu.sol on Medium]]></description>
        <link>https://medium.com/@mrnazu?source=rss-2d61b13f0e77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PtWH48SqPwDSzECjPGObtg.png</url>
            <title>Stories by 0xNazu.sol on Medium</title>
            <link>https://medium.com/@mrnazu?source=rss-2d61b13f0e77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 03:16:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mrnazu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Blockchain Basics: PoS Part 7]]></title>
            <link>https://mrnazu.medium.com/blockchain-basics-pos-part-7-110a6c9d586e?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/110a6c9d586e</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[proof-of-stake]]></category>
            <category><![CDATA[pos]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Sun, 16 Nov 2025 16:04:47 GMT</pubDate>
            <atom:updated>2025-11-16T16:04:47.285Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello! In this part of blockchain basics, we’re going to learn about an alternative consensus algorithm called Proof of Stake (PoS). PoS was developed as an alternative to Proof of Work (PoW) to address some of the issues that PoW doesn’t solve, such as high electricity consumption and excessive computing power requirements.</p><p>PoS uses significantly less energy (around 99% less than PoW ) and is designed to further decentralize the network.</p><p>With Proof of Work, we had miners, who would “mine” blocks using their computers. In a PoS network, these miners are replaced by validators. Instead of mining a block, validators forge or mint a new block.</p><p>Keep that terminology in mind as we go forward.</p><p>With PoS, instead of relying on computing power, graphics cards, or large mining farms like we discussed before, you only need a relatively simple computer. What gives you access to validate transactions is the stake you provide.</p><p>All validators put up stakes, which are in the form of the network’s native token — for example, ETH on the Ethereum network. The amount of ETH you stake determines your ability to validate blocks.</p><p>This is the basic idea behind Proof of Stake.</p><p>Let’s say we have 6 validators, and all of them must provide some form of stake. The minimum stake, as required by the Ethereum PoS protocol, is 32 ETH. This is a significant amount when converted to U.S. dollars, so even though PoS is meant to make it easier for people to become validators, there’s still a high financial barrier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*C3RmP4l5GzgEDvgTUaQnug.png" /></figure><p>In this example, the total stake is 192 ETH (6 validators × 32 ETH each). When a new block needs to be created, one of these validators is randomly selected, but the selection is weighted by the size of their stake.</p><p>Since all validators in this example hold an equal share (1/6 of the total stake), each has about a 1 in 6 chance of being selected.</p><p>However, if one validator stakes more (for example, 64 ETH) their chance of being selected increases. In this case, the validator with 64 ETH now has 2/7 of the total stake, while the remaining validators each still have roughly 1/7. This demonstrates how increasing your stake increases your likelihood of being chosen to validate a block.</p><p>Once a validator is randomly selected, their job is to create a new block using the transaction pool (TX pool) we talked about earlier. They will include all the transactions, validate each one, and assemble the block.</p><p>Since PoS doesn’t rely on solving a cryptographic puzzle like in Proof of Work, there’s no need to guess a number. The validator simply submits the completed block to the other validators.</p><p>The other validators then check the newly created block. If the majority agree that all transactions are valid, the block is added to the blockchain.</p><p>The validator who created the block receives a reward, which comes from the transaction fees included in the block.</p><p>This is the basic idea behind Proof of Stake.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=110a6c9d586e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Basics: PoW — Part 6]]></title>
            <link>https://mrnazu.medium.com/blockchain-basics-pow-part-6-9a38ea444a55?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a38ea444a55</guid>
            <category><![CDATA[proof-of-work]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[bitcoin-mempool]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[miners]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Sun, 28 Sep 2025 08:40:42 GMT</pubDate>
            <atom:updated>2025-09-28T08:40:42.064Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain Basics: PoW — Part 6</h3><p>Hi, in this section we’re going to learn about <strong>Proof of Work (PoW)</strong>.</p><p>Simply put, <strong>Proof of Work</strong> is a piece of data submitted alongside a block by blockchain miners to <strong>prove that a certain amount of computational power has been spent</strong> to validate and create that block.</p><p>Proof of Work forms the <strong>foundation of security</strong> for blockchain networks like Bitcoin. By requiring miners to perform and prove a significant amount of work, the network becomes <strong>increasingly secure over time </strong>because as more work is invested into the network, it becomes harder and more expensive to attack or manipulate.</p><p>Let’s say we have a few <strong>clients</strong> on the right side. These represent regular users of the blockchain network — they could be submitting transactions, holding wallets, or simply interacting with the network. Their specific actions don’t matter too much here; the key point is that they are <strong>participants</strong> in the network.</p><p>At the top, we have a few <strong>blocks</strong>, which represent the <strong>existing blockchain</strong> — the chain of validated and confirmed blocks.</p><p>As we’ve discussed before, there’s also a <strong>transaction pool</strong> (or mempool). Each <strong>miner</strong>(shown here as the <strong>purple blocks) </strong>maintains their <strong>own version</strong> of this transaction pool.</p><p>When clients send transactions, those transactions are <strong>broadcast to the network</strong> and added to the <strong>transaction pool</strong> of each miner. Once the transactions are in the pool, they <strong>wait to be picked up by miners</strong>, who will then include them in the next block they create.</p><p>From there, the rest of the process — validating, mining, and adding the block to the blockchain — works just as we covered in the previous section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*gW2-C1MQHSViABsYbNwFQA.png" /></figure><p>Once a block is added to the blockchain, <strong>all miners essentially reset</strong> and start working on the <strong>next block</strong>. They see the newly added block, gather the remaining transactions from their transaction pools, assemble them into a new block, and continue attempting to solve the <strong>Proof of Work</strong> puzzle. Once a miner successfully adds a new block to the blockchain, they receive a <strong>reward</strong> — currently <strong>6.25 BTC</strong> plus any <strong>transaction fees</strong> included in the block. That’s a substantial incentive for miners to keep the network running securely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*9-2srUGNDPrQXc9goFnJEA.png" /></figure><h3>What’s Actually Involved in Finding PoW? What Does PoW Mean?</h3><p>In each block, there’s a lot of information. We have the <strong>block header</strong>, which contains things like the <strong>block version</strong>, the <strong>previous block’s hash</strong>, and other metadata. Of course, the block also contains all the <strong>transactions associated</strong> with it.</p><p>As I mentioned, <strong>miners</strong> sit in the network and listen for new transactions. Let’s imagine a miner on the left side — this miner maintains its <strong>own transaction pool</strong>, which is essentially a temporary collection of unconfirmed transactions. This pool typically runs in <strong>RAM or memory</strong>, although very large pools may also use <strong>hard disk storage</strong>.</p><p>Whenever a new transaction is <strong>broadcast to the network</strong>, it’s added to the miner’s pool, ready to be selected and included in the next block they attempt to mine.</p><p>Once a miner has assembled the <strong>entire block</strong> — including all the transactions and the proper reference to the <strong>previous block</strong> — they have a <strong>valid block</strong> in terms of structure and content. The next step is to find a <strong>Proof of Work (PoW)</strong>.</p><p>So, what is Proof of Work? Simply put, it’s a <strong>number</strong> that, when combined with the block data and hashed, produces a <strong>hash that meets a specific requirement</strong>: the hash must start with a certain number of zeros.</p><p>This is where the concepts of <strong>nonce</strong> and <strong>bits</strong> come into play. The <strong>bits</strong> in a block represent the <strong>difficulty level</strong> for mining that block. For example, if the bits are set to 20, this means the hash of the block must start with <strong>20 leading zeros</strong> for it to be considered valid. The miner continuously changes the <strong>nonce</strong> — a random number in the block header — and re-hashes the block until this condition is met.</p><p>Once a valid nonce is found, the <strong>Proof of Work</strong> is complete and can be submitted to the blockchain.</p><h3>How someone can attack a Proof-of-Work network</h3><p>When a blockchain forks, two (or more) competing chains can temporarily exist. The network ultimately accepts the chain that becomes <strong>longest</strong> (i.e., the one with the most accumulated work) — the chain that new miners build on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*89pMUYt8U02l5ItkToq-HA.png" /></figure><p>A common attack against PoW is to create and extend a <strong>private (malicious) fork</strong> faster than the honest network, then release it to replace the public chain. To succeed at this you must <strong>out-produce</strong> everybody else — in practice that means controlling a majority of the network’s mining power (commonly called a <strong>51% attack</strong>).</p><p>With &gt;50% of the hash power an attacker can:</p><ul><li>Build a longer private chain that excludes or rewrites transactions (enabling <strong>double-spends</strong>).</li><li>Prevent some transactions or blocks from being confirmed by the honest network (censorship).</li><li>Cause honest miners’ blocks to become <strong>orphaned</strong> when the attacker’s longer chain is published.</li></ul><p>What makes this possible is the PoW rule: nodes always prefer the chain with the most total work. If an attacker can produce blocks faster than everyone else combined, their private chain will eventually become the “longest” and therefore be accepted by the network when revealed. That’s why high total hash power and decentralization of miners are critical defenses for PoW chains.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a38ea444a55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Basics: Security — Part 5]]></title>
            <link>https://mrnazu.medium.com/blockchain-basics-security-part-5-2f7f2bee8040?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f7f2bee8040</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[51-attacks]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Sun, 28 Sep 2025 08:26:32 GMT</pubDate>
            <atom:updated>2025-09-28T08:26:32.380Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain Basics: Security — Part 5</h3><p>So far, we’ve gained a solid understanding of what blockchain is and how it works. Now, it’s time to explore some of the security concerns that come with blockchain technology. After examining these security issues, I’ll explain how the topics we covered earlier address these concerns and how blockchain itself offers solutions to many of them</p><h3>double spending</h3><p>The very first concept we need to discuss when talking about blockchain is the <strong>double-spend problem</strong>. Double spending occurs when someone is able to spend the same coin more than once.</p><p>To understand this better, let’s compare it to physical money. If I hand my friend a $1 bill, I can’t spend that same bill again because it’s now physically in their possession — I’ve lost it, and it’s no longer with me.</p><p>However, when dealing with <strong>digital ledgers</strong>, things work differently. Since everything is represented in binary (0s and 1s), digital assets can easily be copied and pasted. This makes it possible for someone to try to “duplicate” digital money, which is the core of the double-spend problem</p><p>So, how do we avoid double spending? The solution is to <strong>keep track of all transactions</strong> that occur. Whenever you make a transaction, one of the key pieces of data included is a <strong>timestamp</strong>. One of the main reasons Satoshi Nakamoto included timestamps in blockchain was to prevent double spending.</p><p>Each transaction is recorded along with its timestamp, making it very difficult to spend the same funds twice. If someone tries to resend the same transaction, the system can check the records and say, “Hey, this transaction was already sent at this specific time, date, and even year.” As a result, <strong>miners</strong> (or <strong>validators</strong>, in Ethereum) will <strong>reject</strong> the duplicate transaction.</p><h3>order</h3><p>The next issue we’re going to deal with is <strong>transaction ordering</strong>. Earlier, we mentioned that transactions in a blockchain are stored in <strong>chronological order</strong>, and while that’s true for <strong>blocks</strong>, it’s not necessarily true for <strong>individual transactions</strong>.</p><p>Before transactions are added to a block, they sit in a <strong>transaction pool</strong> (also called the mempool). This pool contains all unconfirmed transactions, often in random order — for example, there could be 10,000 transactions waiting to be picked up by miners.</p><p>Miners don’t select transactions based on the exact order they were submitted. Instead, they often pick transactions randomly or based on factors like fees. This means transactions are not stored strictly in chronological order.</p><p>This can create a potential problem: in theory, someone could submit <strong>multiple copies of the same transaction</strong> to the transaction pool. If one of these transactions gets picked up and added to a block, and then another miner later tries to add the duplicate transaction to a new block, it would cause a conflict — because the funds have already been spent in the earlier block.</p><p>Fortunately, blockchain has mechanisms to handle this. The process is quite complex and involves <strong>consensus algorithms</strong>, which ensure that only valid transactions make it into the blockchain and that duplicates are rejected. We’ll dive deeper into how this works when we discuss consensus mechanisms.</p><h3>balance</h3><p>The next issue has to do with <strong>balances</strong>, specifically ensuring that the sender has <strong>sufficient funds</strong> to make a transaction. I’ll keep this part brief since we’ve already discussed how it works earlier.</p><p>One of the main reasons you need to provide <strong>transaction inputs</strong> is to <strong>prove to the blockchain</strong> that you have enough balance to cover the amount you want to send. By including these inputs, you’re essentially showing that the funds exist and are available for spending.</p><p>Without this proof, the blockchain (or more precisely, the miners) would need to scan through <strong>every single block starting from the genesis block</strong>, tracing all historical transactions to calculate your current balance. This would be inefficient and time-consuming.</p><p>For example, if you tried to send 10 BTC without providing any inputs, the network would have to verify whether you actually have 10 BTC by going through your entire transaction history. By requiring transaction inputs, blockchain avoids this problem and ensures that only valid transactions with sufficient funds are processed.</p><h3>code</h3><p>The next and quite interesting problem is related to <strong>code vulnerabilities</strong>. The actual source code of a blockchain can contain <strong>critical security flaws</strong>, which malicious actors can exploit.</p><p>Major blockchains like <strong>Bitcoin</strong> and <strong>Ethereum</strong> have thousands of security researchers constantly <strong>auditing, testing, and improving</strong> their code, making them extremely difficult to exploit.</p><p>However, <strong>newer blockchains</strong> often become targets almost immediately after launch. Due to <strong>poorly written code</strong> and a <strong>lack of thorough auditing</strong>, many of these blockchains have been exploited shortly after their release</p><h3>51% attack</h3><p>This next issue is one of the <strong>most well-known security problems</strong> in the blockchain space — the <strong>51% attack</strong>.</p><p>A 51% attack occurs when a single entity or group gains control of <strong>more than 51% of a blockchain network’s resources</strong>, specifically the <strong>nodes</strong>, <strong>validators</strong>, or <strong>miners</strong>.</p><p>The basic idea is that if someone controls the majority of the network’s power, they can <strong>manipulate the blockchain</strong> to their advantage. With over 51% control, an attacker could potentially <strong>reverse transactions</strong>, <strong>double spend</strong>, or <strong>block other transactions</strong> from being confirmed.</p><p>This type of attack has already happened in several blockchain networks in the past, especially on <strong>smaller and less secure networks</strong>, where it’s easier for an attacker to gain majority control.</p><p>We haven’t yet covered the more complex aspects of blockchain, but this gives a solid overview of some of the key security concerns so far.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f7f2bee8040" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Basics: TX and Block — Part 4]]></title>
            <link>https://mrnazu.medium.com/blockchain-basics-tx-and-block-part-4-a2e4b3567e1f?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2e4b3567e1f</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[wallet]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[block]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Mon, 05 May 2025 10:30:33 GMT</pubDate>
            <atom:updated>2025-05-05T10:30:33.760Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain Basics: TX and Block — Part 4</h3><p><strong>Important:</strong> In this section, we’ll use <strong>TX</strong> to mean “transaction” and focus on how TXs work in <strong>Bitcoin</strong>.</p><h3>Transaction</h3><p>When it comes to a transaction, there are 6 <strong>main components</strong>:</p><ol><li><strong>From address</strong> — the sender’s address</li><li><strong>To address</strong> — the recipient’s address</li><li><strong>Amount</strong> — how much is being sent</li><li><strong>Signature</strong> — proof that the sender approves the transaction</li><li><strong>Fee (or Gas)</strong> — the cost to process the transaction (called <em>gas</em> on Ethereum)</li><li><strong>TX Hash</strong> — a unique identifier for the transaction, created by hashing all the info from 1–5</li></ol><p>That’s what makes up a basic transaction. There’s also a <strong>timestamp</strong>, but we don’t need to add that manually, Bitcoin handles it on its own. This built-in timestamping also helps prevent the <strong>double-spend problem</strong>. That’s pretty much how it works on Bitcoin.</p><p>Now, <strong>Ethereum</strong> adds <strong>two more layers</strong>:</p><ol><li><strong>Nonce</strong> — short for “number used once.” Since Ethereum doesn’t use miners (it uses <strong>validators</strong> instead), each account uses a nonce to keep transactions in order and prevent replay attacks.</li><li><strong>Data</strong> — this is where extra info goes. It could be something simple like the text “hi” or it could be function calls for a smart contract (even the contract’s compiled code itself). Sometimes there’s no data at all, it depends on what the TX is doing.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dIk3uFmFv7aTKnozJKktDA.png" /></figure><p>We actually talked about this in our previous <strong>Advanced Blockchain</strong> article, but just to recap, there are 3 main components in the transaction process: <strong>transactions (TXs)</strong>, the <strong>blockchain</strong>, and the <strong>TX pool</strong>.</p><p>The <strong>TX pool</strong> (or mempool) is where transactions go before they get added to the blockchain. When we send a transaction, it first enters this pool, along with a bunch of other pending transactions.</p><p>From here, <strong>miners</strong> (on Bitcoin) or <strong>validators</strong> (on Ethereum) pick up transactions from the TX pool. These miners/validators verify each transaction to make sure it’s valid. Then they start assembling something called a <strong>block</strong>, which is just a bundle of transactions. Once the block is ready, they <strong>submit</strong> it by appending it to the blockchain.</p><p>When we create a transaction, it has two main parts: <strong>inputs</strong> and <strong>outputs</strong>. On the <strong>output</strong> side, we have:</p><ul><li>The <strong>recipient address(es)</strong> (the “To” field)</li><li>The <strong>amount</strong> being sent</li><li>The <strong>fee/gas</strong> paid to the network</li><li>And finally, the <strong>change</strong>, which is any leftover balance that gets sent back to us</li></ul><p>But before we can even make a transaction, we need to <strong>prove we have enough balance</strong> in our wallet to cover it.</p><p>How do we do that?</p><p>We include <strong>previous transactions</strong> as <strong>inputs</strong> to the new transaction. Since your wallet technically starts with a balance of zero, it builds its balance by tracking incoming TXs. When you’re ready to send something, you reference these past TXs as the source of your funds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*31XO0GdOZln0XZKoYm8h1A.png" /></figure><p>This is how it works in general. Now let’s talk about <strong>digital signatures</strong>, which are super important for sending a transaction. Every transaction (TX) has <strong>input</strong> and <strong>output</strong> data. Together, this data makes up what we call the <strong>message</strong>. We run this message through a <strong>hash function</strong>, which gives us the <strong>TX hash</strong>:</p><pre>message → hash function → TX hash</pre><p>Once we have the TX hash, the next step is to <strong>generate a digital signature</strong> for it. This is where cryptography comes in. There are two parts involved:</p><ul><li><strong>SK (Signing Key)</strong> — this is your <strong>private key</strong></li><li><strong>VK (Verification Key)</strong> — this is your <strong>public key</strong></li></ul><p>You use your <strong>private key</strong> (SK) to <strong>sign</strong> the transaction. This proves that you’re the owner of the wallet sending the TX. Then, anyone can use your <strong>public key</strong> (VK) to <strong>verify</strong> the signature. It doesn’t decrypt a hidden message, what it really does is confirm that the signature came from the matching private key and that the TX data hasn’t been changed.</p><h3>Blocks</h3><p>Continuing with transactions (TXs), let’s talk about <strong>blocks a</strong>nd why they’re called that. We’ve already seen the basic idea: a <strong>block</strong> is a container that stores transaction data, logs, and other info. These blocks are then linked together in <strong>chronological order</strong>, forming the <strong>blockchain</strong>.</p><p>It all starts with the <strong>transaction pool</strong> (also called the mempool), which holds a bunch of <strong>unconfirmed transactions, </strong>they’ve been broadcast to the network but haven’t been added to the blockchain yet.</p><p>Next, we have a bunch of <strong>miners</strong> (in Bitcoin) or <strong>validators</strong> (in Ethereum). These actors scan the TX pool, pick a set of valid transactions, and try to create a new <strong>block</strong>.</p><p>Once they gather the transactions, they start the process of building a block and (depending on the network) either <strong>mine it</strong> (proof of work) or <strong>validate it</strong> (proof of stake). Once the block is successfully created and verified, it gets added to the chain, and the process continues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*TVbFmQWwxAm1zCid8Hk2zg.png" /></figure><h3><strong>So what’s actually inside a block?</strong></h3><h4>1. Magic Number</h4><p>The first thing in a block is the <strong>magic number</strong>. It’s just a specific, constant value that identifies which blockchain this block belongs to. For example, Bitcoin has its own unique magic number that all Bitcoin blocks contain. It’s basically a tag that says, “Hey, I belong to the Bitcoin network.” Since there are tons of blockchains out there, each network needs its own magic number to avoid confusion. Ethereum has its own, and so do many others.</p><h4>2. Block Size</h4><p>Next up is the <strong>block size</strong>. This sets the maximum amount of data a block can store. It doesn’t mean every block hits that limit, it just can’t go over it. On Bitcoin, the max block size is 1MB.</p><h4>3. Block Header</h4><p>After that, we have the <strong>block header</strong>, which contains metadata about the block. It’s like the block’s ID card, just a summary of important info.</p><h4>4. Transaction Count</h4><p>Pretty straightforward: this is just the number of transactions inside the block.</p><h4>5. Transaction Data</h4><p>This is the bulk of the block, every single transaction included in it. It’s the reason the block exists.</p><h4>6. Version</h4><p>The version shows what protocol or rules the block follows. It helps nodes understand how to process the block.</p><h4>7. Previous Block Hash</h4><p>This is how blocks are chained together. For example, let’s say we have two blocks: B1 and B2. B2 will store the <strong>hash of B1</strong> inside itself. That’s how B2 “links” to B1. You take B1, run it through a hash function, and store the result inside B2. That’s how we get the chain in “blockchain.”</p><h4>8. Merkle Root Hash</h4><p>We’ve talked about this in detail in the advanced blockchain article. But in short, the <strong>Merkle root hash</strong> is a fast way to check whether a specific transaction belongs in a block and if it’s valid, without checking every single transaction individually.</p><h4>9. Timestamp</h4><p>The <strong>timestamp</strong> marks the exact time the block was created. It helps keep everything in order and plays a role in preventing double-spend attacks.</p><h4>10. Bits / Difficulty</h4><p>We haven’t covered this much before, but <strong>bits</strong> (or difficulty) show how hard it is to mine a block. The higher the bits, the harder it is. For example, 10 bits is easier than 20 bits. We’ll dive deeper into this when we cover Proof of Work vs. Proof of Stake.</p><h4>11. Nonce</h4><p>You probably remember this from earlier. The <strong>nonce</strong> is the number miners change over and over again when trying to find a valid hash for the block.</p><h4>12. Block Reward</h4><p>Finally, we’ve got the <strong>block reward</strong>. This is the amount of crypto (like Bitcoin) given to the miner who successfully mined the block. The reward decreases over time and is what motivates miners to keep mining.</p><p><strong>Alright, so those are the main components you’ll find in every block on a blockchain.</strong></p><p>Now, let’s talk about something special, the very <strong>first block</strong>, also known as the <strong>Genesis Block</strong>.</p><h3>What Is the Genesis Block?</h3><p>The <strong>Genesis Block</strong> is basically the “starter” block. It kicks off the entire blockchain. It’s called <em>Genesis</em> because it’s the beginning, the origin. This block includes most of the things we talked about before: version, previous hash (which in this case is usually just zero or null since there’s no block before it), Merkle root, timestamp, nonce, and so on.</p><p>But the Genesis Block also defines a few <strong>special properties</strong> that you don’t typically see in later blocks.</p><h4>1. Difficulty &amp; Difficulty Interval</h4><p>You may remember that <em>difficulty</em> is represented by a certain number of bits. The higher the bits, the harder it is to mine a block. The <strong>Genesis Block sets the initial difficulty</strong> for the whole network. It also defines the <strong>difficulty adjustment interval, </strong>meaning how often the network adjusts mining difficulty.</p><p>For example, in Bitcoin, the difficulty is recalculated every 2,016 blocks based on how long it took to mine the previous 2,016 blocks. If blocks were mined too fast, the difficulty increases; if too slow, it decreases.</p><h4>2. Mining Reward &amp; Reward Schedule</h4><p>The Genesis Block also defines the <strong>block reward</strong> — how many coins a miner gets for successfully mining a block. This reward can <strong>change over time</strong> (usually decreasing). In Bitcoin, the reward started at 50 BTC and halves roughly every 210,000 blocks.</p><p>This reward is <strong>newly minted coins</strong>, meaning it’s the only way new BTC enters circulation.</p><h4>3. Circulating Supply &amp; Maximum Supply</h4><p>Another important parameter defined early on is the <strong>maximum supply</strong> of coins. For Bitcoin, this is <strong>21 million BTC</strong>. That means, no matter what, <strong>there will never be more than 21 million Bitcoin</strong> in existence. This limited supply is built into the protocol, ensuring scarcity.</p><h3>Final Thoughts</h3><p>Hopefully, this gives you a solid overview of what a <strong>transaction</strong> and a <strong>block</strong> are, and how everything fits together, especially with the Genesis Block as the foundation.</p><p>Of course, there’s a lot more detail behind each of these parts, but this gives you the general picture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2e4b3567e1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Basics: Ledgers and Wallets — Part 3]]></title>
            <link>https://medium.com/thecapital/blockchain-basics-ledgers-and-wallets-part-3-5507dc83649d?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/5507dc83649d</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[wallet]]></category>
            <category><![CDATA[hash-function]]></category>
            <category><![CDATA[address]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Tue, 18 Feb 2025 09:43:02 GMT</pubDate>
            <atom:updated>2025-02-19T02:21:36.625Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain Basics: Ledgers and Wallets — Part 3</h3><p>In Part 2 (<a href="https://medium.com/thecapital/blockchain-basics-trustless-systems-part-2-7a07fc61564b">Trustless Systems</a>) of our Blockchain Basics series, we covered the evolution of the internet from Web1 to Web3, their differences, and the basic definition of blockchain. Now, we’re gonna talk about ledgers, arguably the core of what makes blockchain work and the most important aspect of Web3: <strong><em>Wallets.</em></strong></p><p>Ledgers are important to understand because, <strong><em>at its core, a blockchain is just a ledger.</em></strong> Though it’s much more than that, of course. The main idea behind blockchain is to keep track of all transactions happening on a specific network. In this section, I’ll break down how ledgers work, some security challenges they face, how blockchain solves those issues, and more.</p><p><strong>Imagine this:</strong> Sammy and Nazu are friends who frequently loan each other money. Over time, it becomes hard to keep track of who lent what, and they sometimes forget the amounts, as a result, they face some confusion and even conflict. So, they decided to create a simple system to record all their transactions.</p><p>Their solution? <strong>A ledger!</strong> just a notebook or a piece of paper where they list every loan. To keep it simple, let’s give them identifiers: <strong>S</strong> for Sammy and <strong>N</strong> for Nazu.</p><p>For example, on <strong>2024/11/10</strong>, Sammy lends Nazu <strong>200 $</strong>. To track this, they write it down:<br><strong>S &gt; N: 200 $</strong></p><p>The next day, Nazu pays back <strong>150 $</strong> to Sammy. So, they add another entry:<br><strong>S &lt; N: 150 $</strong></p><p>At the end of the month, they check their ledger and see that Sammy has sent more money to Nazu overall. After doing the math, they realize that Nazu still owes Sammy <strong>50 $</strong>, so he needs to pay that back to settle their accounts. This is the basic idea behind a ledger, it helps keep track of transactions in a clear and organized way.</p><p>The problem with this ledger, though, is that <strong>S and N have to trust each other completely</strong>. What if one day, Nazu thinks, <em>“Sammy isn’t checking the ledger. I’ll just change the 50 $ I owe to 10 $ instead.”</em> If Sammy doesn’t notice, he might believe it. That’s the first major issue: <strong>anyone can modify the ledger at any time</strong>, which makes it unreliable.</p><p>So how do we fix this? The first idea that comes to mind is <strong>introducing a third party</strong> to verify transactions. This third party would check and confirm that, yes, Sammy sent this amount, and yes, Nazu paid back that amount. Now, instead of managing the ledger themselves, S and N go through the third party, let’s call it a <strong>bank (B)</strong>.</p><p>The bank now <strong>records, stores, and maintains the ledger</strong>, while Sammy and Nazu can only view it but <strong>can’t make changes themselves</strong>. This removes the need for trust between S and N, but now the trust is placed <strong>entirely on the bank</strong>. And here’s the problem: <strong>aren’t we trying to build a decentralized system?</strong></p><p>At the end of the day, the bank could still <strong>modify, delete, or add transactions</strong> however it wants. Even worse, S and N have no way of knowing if the ledger is accurate. And here’s where things get political, what if one day, a new government comes into power and <strong>decides to change financial policies, manipulate banks, or even use the system as a weapon against opponents?</strong> Would you still trust the bank then? Probably not.</p><p>So, adding a third party <strong>seems</strong> like a solution, it just <strong>creates a new problem tho: </strong>centralized control over the ledger. Now, instead of trusting just one person, you’re trusting a whole system that can be influenced or even corrupted.</p><p>This is where <strong>blockchain comes in</strong>. This is exactly why blockchain was invented, to solve problems like this.</p><p>We <strong>don’t</strong> want a central entity.<br>We <strong>don’t</strong> want a bank.<br>We <strong>don’t</strong> want one person, one group, or one company <strong>controlling our data or our ledger</strong>.</p><p>What if the bank gets hacked? All the money could be lost. The ledger could be stolen, destroyed, or even manipulated. This is the <strong>biggest issue</strong> with storing important data in a <strong>centralized</strong> system, if that single point of failure gets compromised, everything falls apart.</p><p>Now, to be fair, it might not always be the bank’s fault if they get hacked. But at the end of the day, <strong>they are responsible for securing their system</strong>, and if they fail, it’s still their responsibility. So instead of relying on a system that can be attacked, manipulated, or controlled, we need a <strong>better way, </strong>a system where no single entity holds all the power. That’s exactly what blockchain offers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UaOLCClMl1eSid6efwiJxQ.png" /></figure><p>In this context, <strong>ledger and blockchain are basically the same thing</strong>, but keep in mind our earlier definition of blockchain: A blockchain is a distributed, decentralized, publicly available ledger or transactions that are verified.</p><h4>1. Distributed</h4><p>Look at the first example (in the image above). That ledger <strong>isn’t distributed, i</strong>t’s stored in <strong>one place</strong>. What happens if the bank shuts down? The ledger disappears with it.</p><p>Now, on the right-hand side, we have a <strong>blockchain ledger</strong>, which is <strong>distributed</strong> across multiple participants, or <strong>nodes</strong> (represented by the yellow dots storing copies of the ledger). If one or two nodes go offline, <strong>the ledger still exists</strong> because <strong>other nodes still have a copy</strong>. So, <strong>accessing the blockchain = accessing the ledger</strong> at any time.</p><h4>2. Decentralized</h4><p>Unlike a traditional ledger stored by a single entity (like a bank), a blockchain ledger is held by <strong>many different people</strong>. This means <strong>no single entity controls it</strong>, reducing the risk of manipulation or failure.</p><h4>3. Publicly Available</h4><p>Anyone can <strong>view</strong> the ledger from <strong>any of these different nodes</strong>. This <strong>transparency</strong> ensures that <strong>no one</strong> can secretly alter the records. And that’s the key difference. A <strong>blockchain ledger effectively solves the trust problem</strong> by being <strong>distributed, decentralized, and publicly verifiable</strong>.</p><p>Now, let’s talk about some key <strong>properties</strong> of blockchain. <strong>(1)</strong> One of the biggest features of blockchain is that it’s <strong>immutable, </strong>meaning it <strong>can’t be changed over time</strong>. Once something is recorded, it stays there <strong>forever</strong>. <strong>(2)</strong> We already know this: <strong>blockchains are public</strong>. That means <strong>anyone</strong> can view the data. No hidden records, no secrecy. <strong>(3 )</strong> Instead of being controlled by <strong>one</strong> central authority (like a bank or government), blockchain is controlled by <strong>many different nodes</strong>. This prevents <strong>a single point of failure</strong> and ensures that <strong>no one</strong> has total control. <strong>(4)</strong> The data is <strong>spread out</strong> across multiple locations (nodes). <strong>No single entity owns it. E</strong>veryone shares the same version of the truth. <strong>(5)</strong> Everything on the blockchain is stored <strong>in order, </strong>from the <strong>earliest transactions</strong> to the most <strong>recent ones</strong>. If there were <strong>no order</strong>, the entire system would be a mess. The <strong>chronological structure</strong> ensures everything is properly recorded and traceable. <strong>(6)</strong> This is a big one. <strong>Once a transaction is recorded, it can’t be changed, reversed, or deleted</strong>. If I send you <strong>200 $ in BTC</strong>, I <strong>can’t</strong> take it back. No refunds, no chargebacks. <strong>What’s on the blockchain stays on the blockchain: forever.</strong></p><h3>Wallets</h3><p>A <strong>wallet</strong> is basically your <strong>bank account</strong> on a blockchain. It lets you <strong>send, receive, and store funds</strong> securely. In this section, I’ll break down <strong>how wallets work</strong>, <strong>how to create one</strong>, <strong>how to keep it secure</strong>, and a lot more. This is just the <strong>fundamentals</strong>, but everything we cover here applies to <strong>99% of blockchain wallets, </strong>they all work in pretty much the same way. With that said, let’s get started. But before everything, you need to understand <strong>three important terms</strong>: (1) <strong>Private Key (2) Public Key (3) Address</strong></p><p>All of these are <strong>deeply connected</strong>, and <strong>everything starts with the private key</strong>.</p><h4>What is a Private Key?</h4><p>A <strong>private key</strong> is essentially the <strong>password</strong> to your <strong>wallet</strong>. It’s the most important part of your wallet’s security. If you <strong>lose your private key</strong>, you <strong>lose access to your funds: </strong>forever!! You won’t be able to send transactions, check your balance, or recover your wallet. <strong>No one</strong> can help you get it back. There’s no support team, no “forgot password” option, nothing!!</p><p>So, <strong>protect your private key at all costs</strong>. Store it somewhere <strong>secure and offline, </strong>write it down on paper, save it on different devices, but <strong>never</strong> put it online or share it with anyone.</p><h4>What is a Private Key, Technically?</h4><p>A private key is just a <strong>64-character hexadecimal string</strong> (random numbers and letters). It’s automatically <strong>generated</strong> when you <strong>create a wallet</strong>. You don’t need to memorize it or even fully understand it, just know that it acts as your wallet’s <strong>ultimate key</strong>.</p><h4>Encrypted Private Keys (EPK)</h4><p>Since a private key is so sensitive, it’s usually <strong>encrypted</strong> for extra protection. Here’s how it works:</p><ol><li>You create a <strong>private key</strong> (<strong>PK</strong>).</li><li>You set a <strong>password</strong> (<strong>PWD</strong>), something you can remember, like a password for your Google or X account.</li><li>The private key is <strong>encrypted</strong> using this password. The result is an <strong>Encrypted Private Key (EPK)</strong>.</li></ol><p>So, the encryption process looks like this:</p><blockquote><strong><em>PK + PWD → EPK</em></strong><em> (Encrypted Private Key)</em></blockquote><p>To <strong>use</strong> your private key later, you need to <strong>decrypt</strong> it using the same password:</p><blockquote><strong><em>EPK + PWD → PK</em></strong><em> (Decryption)</em></blockquote><p>This adds an extra layer of security. Even if someone <strong>steals</strong> your encrypted private key, they <strong>can’t use it</strong> without the password.</p><h4>What is a Public Key?</h4><p>As the name suggests, a <strong>public key</strong> is <strong>public, </strong>unlike your <strong>private key</strong>, which must remain secret. Your <strong>public key</strong> is a <strong>unique identifier</strong> for your wallet, and you can freely share it online.</p><p>Once a <strong>private key</strong> is created, we generate a <strong>public key</strong> by passing the private key through a <strong>hash function</strong>. This process converts the private key into a <strong>new, unique value</strong> that acts as your public key.</p><p>The process looks like this:</p><blockquote><strong><em>Private Key → (Hash Function) → Public Key</em></strong></blockquote><p>One key feature of this system is that <strong>you cannot reverse the process, </strong>meaning, someone <strong>cannot</strong> figure out your private key just by knowing your public key. This is an important part of the <strong>security model</strong> used in blockchain.</p><h3>Wallet Address</h3><p>Once we have the <strong>public key</strong> for our wallet, we use a <strong>hash function</strong> again to generate what’s called an <strong>address</strong>.</p><blockquote><strong><em>Public Key → (Hash Function) → Wallet Address</em></strong></blockquote><p>To recap, it all started with the <strong>private key (PK)</strong>, which generated the <strong>public key (PUBK)</strong>, and from that, we created the <strong>wallet address</strong>.</p><p>A <strong>wallet address</strong> is exactly what it sounds like. It’s the identifier that you give to people so they can send you something, like cryptocurrency.</p><blockquote><em>“Hey, this is my wallet. Here’s my address, send me some BTC.”</em></blockquote><p>You might wonder: “If we already have a <strong>public key</strong>, why do we need an <strong>address</strong> as well?”</p><p>Good question! In <strong>Web2</strong>, we usually just use the <strong>public key</strong>. It’s enough to identify us online, like using email addresses or domain names. But in <strong>Web3</strong>, we add an extra layer of security with the <strong>address</strong>. Why? Because it’s possible, though difficult, to try to guess the <strong>private key</strong> from the <strong>public key</strong>.</p><p>By adding the <strong>address</strong>, we make it <strong>harder</strong> for someone to guess the private key. They’d have to guess the <strong>public key</strong> first, then guess the <strong>private key</strong>, which makes it two layers of guessing. This is a fundamental security feature in Web3.</p><p>To make things even more secure, we could introduce an additional layer, similar to how <strong>IP addresses</strong> and <strong>domain names</strong> work. Humans struggle to remember long strings like IP addresses, so we use <strong>DNS (Domain Name System)</strong> to map <strong>domain names</strong> to IPs.</p><p>In the same way, we could create <strong>shorter wallet addresses</strong>. For example, instead of a long string like Bitcoin’s default address, we could have something like “<strong>sammy.btc</strong>” or “<strong>nazu.eth</strong>” for Ethereum. These are <strong>Address Domain Names (ADN)</strong>, which act as shortcuts to your actual wallet address.</p><p>This would solve two problems:</p><ol><li><strong>Better security: </strong>now, anyone trying to guess your private key would have to go through multiple layers of encryption and guessing, making it harder to crack.</li><li><strong>Better user experience: </strong>with ADNs, you won’t have to remember long strings or copy-paste addresses anymore.</li></ol><p>Now that we understand the three core concepts: <strong>private key</strong>, <strong>public key</strong>, and <strong>wallet address, </strong>let’s talk about how <strong>hash functions</strong> work and why they’re crucial to the security of your wallet. Having these three components is important, but <strong>security</strong> also depends on how these elements are secured.</p><h3>Hash Functions</h3><p>This is basically how the security mechanism behind our wallets works. We take our <strong>private key (PK)</strong> and pass it through a <strong>hash function</strong>, which then outputs the <strong>public key (PUBK)</strong>.</p><p>One of the key properties of a hash function is that it’s nearly impossible to trace the output back to its original input. This means that, from the output (the public key), you can’t figure out the original input (the private key). To illustrate this, here’s how the <strong>public key</strong> and <strong>private key</strong> interact with the <strong>hash function</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6SOXdE1KVFszw7R_0CVyA.png" /></figure><p>With a typical function, what you can do is find what’s called the <strong>inverse</strong> of that function. The inverse of a function is written like this: <strong>f⁻¹(x) = y</strong>. But if you know the original input, it would look like <strong>f⁻¹(y) = x</strong>.</p><p>What this means is that, given the output (Y) from a function, you can usually figure out what the input (X) was to generate that output. For example, if we have a function like <strong>f(x) = x + 2</strong>, and we pass <strong>x = 1</strong> into it, we get the output <strong>f(1) = 3</strong>. It’s easy to figure out, given the output <strong>3</strong> and the function <strong>f(x)</strong>, what the original input was (<strong>x = 1</strong>) to generate that output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2VYMQeoKTvSuZU6qH0LNw.png" /></figure><p>What we actually do is the inverse: <strong>y = x + 2</strong>. So, given <strong>Y</strong>, we can figure out what <strong>X</strong> is. It’s simple: <strong>y — 2 = x</strong>. So if you give me <strong>Y</strong>, which in this case is <strong>3</strong>, I can plug it into my inverse function (<strong>y — 2 = x</strong>) to get <strong>x = 1</strong>.</p><p>Now, the property of a hash function is that there’s no inverse. It’s practically impossible, mathematically, it just can’t be done. The only way to get back to the original input is by guessing, which could take millions of years.</p><p>Next, hash functions produce an output that’s uniform. What I mean by that is the output always has certain properties, like, it will always be the same length.</p><p>Another property is that hash functions are <strong>deterministic</strong>. This means if I pass <strong>X</strong> into the hash function, it will always give me the same <strong>Y</strong>.</p><p>One more thing: <strong>hash collisions</strong> are extremely rare. What I mean by a collision is when two different inputs (<strong>x1</strong> and <strong>x2</strong>) produce the same output (<strong>y</strong>). It’s practically impossible for that to happen due to the math behind the hash function, though I can’t guarantee it 100%.</p><p>Lastly, when we talk about a hash function, we pass an input (<strong>X</strong>) into it, and the result is called a <strong>digest</strong>, <strong>hash</strong>, or <strong>output</strong>.</p><p>That’s all I’ve got for wallets. Hope this section was helpful!</p><ul><li><a href="https://medium.com/thecapital/blockchain-basics-understanding-web1-web2-and-web3-part-1-5b00b7c79cf3">Blockchain Basics: Understanding Web1, Web2, and Web3 — Part 1</a></li><li><a href="https://medium.com/thecapital/blockchain-basics-trustless-systems-part-2-7a07fc61564b">Blockchain Basics: Trustless Systems — Part 2</a></li></ul><blockquote><em>Want to get into DeFi yield and airdrop farming? Don’t have time? Don’t know where to start?</em></blockquote><blockquote><a href="https://oneclickfi.notion.site/101df4bdd2cd4f428870ce0486bc41ca">Join our newsletter and private group of 300+ DeFi farmers</a> for simple, top 5-minute yield opportunities — plus get our 400+ airdrop database as a bonus!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5507dc83649d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/blockchain-basics-ledgers-and-wallets-part-3-5507dc83649d">Blockchain Basics: Ledgers and Wallets — Part 3</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Basics: Trustless Systems — Part 2]]></title>
            <link>https://medium.com/thecapital/blockchain-basics-trustless-systems-part-2-7a07fc61564b?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a07fc61564b</guid>
            <category><![CDATA[decentralized]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[centralized]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Wed, 12 Feb 2025 15:47:17 GMT</pubDate>
            <atom:updated>2025-02-14T02:21:38.620Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Blockchain Basics: Trustless Systems </strong>— <strong>Part 2</strong></h3><p>Building on Part 1 of Blockchain Basics, let’s talk about how blockchain works as a trustless system.</p><h3><strong>Intro to Blockchains</strong></h3><p>A blockchain is a way of recording information that’s extremely hard to change, hack, or manipulate. It works like a digital ledger that keeps track of transactions, but instead of being stored in one place, it’s copied and shared across an entire network of computers. This makes it decentralized — no single person or organization owns or controls it.</p><h3><strong>Centralized Systems: No Trust, No Users</strong></h3><p>In this section, I’ll break down centralized vs. decentralized systems and why decentralization matters, especially in blockchain.</p><p>Let’s start with some examples of centralized entities: Google, WhatsApp, Facebook, Coinbase, Ethio Telecom, Amazon — the list goes on. These are all centralized systems, meaning they’re controlled by a single entity. Most of the systems we interact with today are centralized, and anything controlled by one organization can be manipulated. There’s no real fairness in a centralized system.</p><p>Take Google, for example. Millions of people use it because they trust it. They search for information, store their data, and rely on Google&#39;s services. But what happens if Google gets hacked? Suddenly, all that trust is gone, and people stop using it. Whether you realize it or not, you’re placing a huge amount of trust in the companies you use every day.</p><p>Same with Telegram — you send private messages because you trust them to keep your chats secure. But if one day, those messages get leaked? You’d probably stop using Telegram, and people worldwide might do the same. Trust is the foundation of any centralized system.</p><p>Now, you might be wondering why I included Coinbase in this list. Isn’t it a crypto exchange? Doesn’t that mean it’s decentralized? Not at all. Coinbase is centralized, just like a bank. They control your account, and if they decide to ban you, freeze your funds, or change their fees, there’s nothing you can do about it. Just because a company deals with crypto doesn’t mean it’s decentralized. Keep that in mind.</p><h3><strong>Decentralized Systems: No More Blind Trust</strong></h3><p>As you can see in the image below, decentralized systems aren’t controlled by a single entity. Let’s start with a formal definition:</p><blockquote>“it is the process by which the activities of an organization, particularly those regarding planning and decision making, are distributed or delegated away from a central, authorities location or group.”</blockquote><p>The image explains this concept well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*lwTv5Nn49FzHi9x0RR7rrg.png" /></figure><p>Now, here’s where things get interesting — decentralized systems allow for <strong>trustless</strong> interactions. In a decentralized system, you don’t need to trust a single company, government, or organization. Instead, you trust the network itself — made up of many independent participants. The security comes from cryptography, algorithms, consensus mechanisms, and the technology behind the network. This means decentralization significantly reduces the need for trust in any one party. The system works because of the rules embedded in the code, not because you “trust” a company to do the right thing.</p><h3>Pros and Cons of Decentralization</h3><p>Like everything in life, decentralization has both advantages and disadvantages. Let’s lay them out in a simple table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*MkWIDawmine0D3_nzAFHfQ.png" /></figure><p>Thanks for reading! If you haven’t already, check out Part 1, where I break down Web1, Web2, and Web3 and how they evolved over time:</p><ul><li><a href="https://mrnazu.medium.com/blockchain-basics-understanding-web1-web2-and-web3-part-1-5b00b7c79cf3">Blockchain Basics: Understanding Web1, Web2, and Web3 — Part 1</a></li></ul><blockquote><em>Want to get into DeFi yield and airdrop farming? Don’t have time? Don’t know where to start?</em></blockquote><blockquote><a href="https://oneclickfi.notion.site/101df4bdd2cd4f428870ce0486bc41ca">Join our newsletter and private group of 300+ DeFi farmers</a> for simple, top 5-minute yield opportunities — plus get our 400+ airdrop database as a bonus!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a07fc61564b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/blockchain-basics-trustless-systems-part-2-7a07fc61564b">Blockchain Basics: Trustless Systems — Part 2</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Basics: Understanding Web1, Web2, and Web3 — Part 1]]></title>
            <link>https://medium.com/thecapital/blockchain-basics-understanding-web1-web2-and-web3-part-1-5b00b7c79cf3?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b00b7c79cf3</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[web2]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 11:21:52 GMT</pubDate>
            <atom:updated>2025-02-12T23:47:15.918Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain Basics: Understanding Web1, Web2, and Web3 — Part 1</h3><p>In this first part of our series, we’re going to break down the evolution of the internet from Web1 to Web3.</p><p>So, if you previously read my article on advanced blockchain and found it a bit complex or didn’t quite get it, then this article is probably for you. I’m going to answer three fundamental questions: (1) What is a blockchain? (2) How does a blockchain work? And (3) Why is it secure?</p><p>To answer these questions, I’ll cover concepts like decentralization, wallets, transactions, signatures, blocks, and the difference between the first block in the blockchain and later blocks. We’ll also talk about how these blocks are created and mined, as well as algorithms like proof of work and proof of stake. We’ll touch on nodes too — basically, we’re going to cover a lot! But keep in mind that this is all theoretical for now. Once you finish this, you can dive into my advanced article or jump into Solidity development.</p><p>So, for now, I’ll start by looking at the evolution of the internet. I’ll explain the differences between Web 1.0, Web 2.0, and Web 3.0. Web 1.0 was the very first basic stage of the internet, while Web 3.0 represents the future of the internet. Right now, we’re transitioning into Web 3.0, which is pretty exciting!</p><h3>Web 1.0</h3><p>Web 1.0 was the era from 1991 to 2004, and it was pretty basic. Websites were mostly static pages — “read-only web.” There wasn’t much interactivity; all we really did was browse and search for information. Ads weren’t allowed back then, and web design relied heavily on frames and tables for layout, with no CSS to help style things.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0EbxYf4Q6M8XlYPUUUtGwg.png" /></figure><h3>Web 2.0</h3><p>Now, we’re in the Web 2.0 era, which is all about user-generated content and interaction. Websites like Facebook, Twitter (or X), and YouTube are prime examples of this phase. Unlike Web 1.0, where everything was static, Web 2.0 focuses on a better user experience and design. We’ve moved away from tables for layout and embraced CSS for styling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tl1QKYmv1xeqqny7B9WmFg.png" /></figure><p>This era also introduced dynamic websites powered by AJAX, JSON, and JavaScript, meaning when you click a button, you might see an animation or a new page load without refreshing the entire site. Community engagement is a big deal here, but there’s a downside: user data is controlled by central authorities like Google, Facebook, and Amazon. For instance, if you tweet on X, everything — your account name, password, tweets — is owned by them, even though it’s all tied to you.</p><h3>Web 3.0</h3><p>So, what about Web 3.0? This is where the future of the internet is heading. We’re already seeing some Web 3.0 technologies popping up, but it’s still in its early stages. When we talk about Web 3.0, we think of cryptocurrencies like Bitcoin and Ethereum, as well as concepts like the metaverse.</p><p>Web 3.0 shifts the focus from user interface and experience to backend systems, databases, and ledgers. It’s all about how data is stored and controlled — data isn’t owned by a single entity anymore; it’s shared across the network. This decentralization is one of Web 3.0’s key features, moving away from having companies own all our data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YfdITGY4uW2Wqxu667KpA.png" /></figure><p>Another cool aspect of Web 3.0 is its portability and personalization. It emphasizes immersion rather than just interaction. Think about the metaverse: the goal isn’t just to browse the internet but to live a life online, fully immersing yourself in that digital world. Along with blockchain and decentralization, we also have AI playing a role in this new landscape, which is important even though we’ve seen it in Web 2.0.</p><p>So, that’s a quick overview of where we’ve been and where we’re headed with the web!</p><h3>Web 2.0 vs. Web 3.0</h3><p>Let’s break down the differences between Web 2.0 and Web 3.0 using a simple example: posting content online, like tweeting. In Web 2.0, when you make a tweet on a platform like X, that tweet is owned and controlled by them. They have the power to censor it, remove it, or even ban you from the platform altogether. Essentially, they hold all the control over your content.</p><p>Now, let’s flip that around and look at Web 3.0. In this new era, platforms are decentralized, meaning there isn’t a single authority or company that owns and controls all the data. Instead, the data is shared across the entire network. So, in this context, if you tweet something on a Web 3.0 platform, no one can censor it, ban you, or delete your tweet. Once it’s out there, it’s there for good — unchangeable and permanent.</p><p>This is how Web 3.0 handles user-generated content. It gives you more freedom and ownership over what you create. Hopefully, this gives you a clearer picture of the contrast between the two!</p><p><strong>TL:DR</strong> web2 is all about making things look good: UI/UX but web3 doesn’t care too much about that. It’s more focused on the backend, like how your data is stored and all that.</p><blockquote><em>Want to get into DeFi yield and airdrop farming? Don’t have time? Don’t know where to start?</em></blockquote><blockquote><a href="https://oneclickfi.notion.site/101df4bdd2cd4f428870ce0486bc41ca">Join our newsletter and private group of 300+ DeFi farmers</a> for simple, top 5-minute yield opportunities — plus get our 400+ airdrop database as a bonus!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b00b7c79cf3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/blockchain-basics-understanding-web1-web2-and-web3-part-1-5b00b7c79cf3">Blockchain Basics: Understanding Web1, Web2, and Web3 — Part 1</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn How to Use Go-Ethereum and Puppeth]]></title>
            <link>https://medium.com/thecapital/learn-how-to-use-go-ethereum-and-puppeth-7e345642557b?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e345642557b</guid>
            <category><![CDATA[geth]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[puppeth]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 12:49:00 GMT</pubDate>
            <atom:updated>2025-02-15T03:25:29.133Z</atom:updated>
            <content:encoded><![CDATA[<p>I just wrote about Geth and how to use it. After reading this, you’ll be able to interact with nodes and the blockchain itself using JSON-RPC. You’ll also learn how to create your own blockchain, create a new account, and mine a block.</p><p>Hey everyone! In this article, I’m going to walk you through how blockchain nodes communicate. This is for those of you who already have a solid understanding of how blockchains work. If you’ve read my articles on Solidity, Ethereum, and the fundamentals of blockchain (or even the more advanced stuff), you’re in the right place!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-rGFMinJRmRvR64-IwWSbQ.png" /><figcaption>ss0 — mining my very own blockchain 🤭</figcaption></figure><p>This isn’t going to get overly technical, so don’t worry if you’re not a hardcore developer. Plus, I’ve linked all the files you’ll need down below so you can download and install them on your Linux distro. If you’re not using Linux, no problem you can always set up a virtual machine or Docker.</p><p>Alright! First, we’ll talk about <strong>Go Ethereum</strong> (or <strong>geth</strong>, for short). Geth is a command-line tool and the official Go implementation of Ethereum. It’s widely used and serves as the standard for most Ethereum-based projects. We’re going to use it a lot in this guide, so get ready to familiarize yourself with it.</p><h3>Download and Install Geth</h3><p>Let’s get started with installing <strong>geth</strong>! First, we need to update the package lists on your Linux system. This step ensures you have the latest tools available, which is important for this and any future exercises.</p><p>Run this command to update your package list:</p><pre>sudo apt-get update</pre><p>Next, we’ll install <strong>cURL</strong>, a handy tool we’ll need for downloading files. Most Linux distros come with cURL pre-installed, but if yours doesn’t, just run:</p><pre>sudo apt-get install curl</pre><p>If it asks you to confirm using additional disk space, just type “yes” and hit enter.</p><p>Now, let’s download Geth and the additional tools. Use this <strong>curl</strong> command to grab the Geth package and save it as geth.tar.gz:</p><pre>sudo curl -o geth.tar.gz https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-1.8.21-9dc5d1a9.tar.gz</pre><p>Once it’s downloaded, we’ll unpack the archive using the <strong>tar</strong> command. This will extract the files and organize them nicely for us:</p><pre>sudo tar -C geth --strip-components 1 -xzf geth.tar.gz</pre><p>Now, let’s move the Geth tools to your system’s usr/bin folder so you can run them from anywhere:</p><pre>sudo cp geth/* /usr/bin/</pre><p>Finally, let’s clean up. You can delete the downloaded files to free up space, or keep them around if you’d prefer. If you want to clean up, just run:</p><pre>sudo rm -r geth geth.tar.gz</pre><p>And that’s it! Geth &amp; others are now installed on your system. Before we start using it, let me give you a quick overview of how it works and what you can do with it.</p><h3>Basic Overview of Geth</h3><p>Alright, now that you’ve downloaded and installed Geth, let’s talk about what happens when you run it in your terminal. Two main things happen right away: <strong>(1)</strong> <strong>Geth connects to other blockchain nodes</strong> from around the world. Most Ethereum nodes run on this client, and the Ethereum network itself relies heavily on it. <strong>(2)</strong> <strong>Geth opens a JSON-RPC server</strong> on your computer. This lets you interact with your local node programmatically.</p><p>For the first part, Geth starts connecting to other nodes and begins downloading blocks. Essentially, it’s replicating the blockchain locally on your computer, storing the entire chain. Think of it like torrenting, but for blockchain data.</p><h3>Syncing Modes in Geth</h3><p>Geth offers three main ways to sync with the blockchain:</p><ul><li>Full Sync (slow)</li><li>Fast Sync (default)</li><li>Light Sync (experimental)</li></ul><h4>1. Full Sync</h4><p>If you run Geth as a full client in full sync mode, it downloads all the block headers and bodies for every block. It also reprocesses every single transaction ever made on the blockchain. This mode is thorough but incredibly resource-intensive. You’ll need <strong>tons of disk space</strong> (we’re talking dozens of GBs) and <strong>a lot of bandwidth</strong> to keep downloading data from other nodes.</p><h4>2. Fast Sync</h4><p>This is the default option. Like full sync, it downloads all the block headers and bodies, but it only processes the last 1,024 transactions. This reduces the redundancy while still ensuring the blockchain is secure and consistent. It’s faster and less storage-heavy than full sync.</p><h4>3. Light Sync</h4><p>Light sync is the new thing actually. It only downloads the block headers and grabs a snapshot of the current state of the blockchain. This makes it <strong>much faster</strong> and uses far less space around 100 MB. You can be synced up in just a minute or so!</p><h3>JSON-RPC in Geth</h3><p>Here’s the cool part: Geth comes with a built-in <strong>JavaScript JSON-RPC interface</strong>. Think of it as a command line where you can type JavaScript commands to interact with your node and the blockchain itself.</p><p>You can do things like:</p><ul><li>Create new accounts</li><li>Send transactions</li><li>Query blockchain data</li><li>Tons of other cool stuff</li></ul><h3>Ways to Access JSON-RPC</h3><p>There are two main ways to interact with the JSON-RPC: <strong>(1)</strong> <strong>Inter-Process Communication (IPC) </strong>This involves communicating directly with Geth via a file or a pipe. It’s great if you’re running multiple Geth instances on the same machine. <strong>(2)</strong> <strong>HTTP RPC </strong>Geth can also open an HTTP RPC endpoint, which makes it accessible over HTTP. This is where tools like <strong>Web3.js</strong> come in, they allow your browser or web apps to interact with Geth using the HTTP RPC.</p><h3>Running Geth Without Parameters</h3><p>If you’re on Mac, Windows, or Linux, just type geth in your terminal and hit enter. That’s it! Geth will fire up, and the first time you run it, you’ll see a ton of log output flooding your terminal. Don’t panic.. it’s not useless info, but we’ll talk more about it in the next section. For now, we just want to see what happens when you start it up for the first time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JdcTrgn3Zh4tHuveraq-Dw.png" /><figcaption>ss1</figcaption></figure><p>The first thing Geth does is connect to the Ethereum mainnet and begin <strong>block synchronization</strong>. This process downloads the blockchain’s data from the network onto your hard drive. It doesn’t just grab block headers; it pulls the entire block content, which is why it can use a lot of bandwidth and take up a ton of disk space.</p><h4>Synchronization Modes</h4><p>Geth uses three different synchronization modes, depending on how much data you want and how much time and resources you’re willing to spend:</p><ol><li><strong>Fast Mode (default)</strong><br>When you run Geth for the first time, it defaults to fast sync. This mode downloads all the blocks but skips processing transactions except for the last 1,024. It’s faster than the other modes because it focuses on grabbing the data instead of verifying every transaction.</li><li><strong>Full Sync</strong><br>Full sync is the most thorough option. It downloads all the blocks, headers, and content, and it processes every single transaction in the blockchain to ensure security and accuracy. It’s way slower and uses a lot more CPU, bandwidth, and storage, but it ensures the blockchain data on your machine is 100% verified.</li><li><strong>Light Mode</strong><br>This is the lightweight option. It skips downloading all the blocks and only grabs the headers and a snapshot of the current blockchain state. It’s much faster, uses minimal bandwidth, and takes up way less space (around 100 MB). Perfect if you just want to quickly sync and don’t need all the details.</li></ol><h4>Restarting Geth</h4><p>If you stop Geth and restart it, it won’t use fast sync again. Instead, it’ll start a <strong>full sync</strong> by default. Why? Because it needs to re-verify the blocks it downloaded earlier while continuing to sync the rest. This takes a lot more time, CPU, and bandwidth compared to fast sync.</p><p>If you want to use fast sync again, you’ll need to delete the previously downloaded blockchain data. To do this:</p><ol><li>Stop Geth.</li><li>Navigate to your blockchain directory (e.g., Desktop/blockchain/geth-prac/geth).</li><li>Inside the geth directory, you’ll find a folder called chaindata. This is where all the downloaded blocks are stored as separate files.</li><li>Delete the geth directory (or just the chaindata folder if you prefer).</li></ol><p>Once you’ve done that, you can restart Geth, and it’ll begin syncing in fast mode again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Au151G1TZNyvumDxaRyKg.png" /><figcaption>ss2</figcaption></figure><h3>Breaking Down the Geth Logs (ss1, above^)</h3><h4>1. Peer Count</h4><p><strong>Maximum peer count.... ETH=25 LES=0 total=25</strong><br>This shows how many peers (other nodes) Geth will try to connect with.</p><ul><li><strong>ETH=25</strong>: The maximum number of full Ethereum nodes you can connect to.</li><li><strong>LES=0</strong>: No “light” nodes allowed (light nodes don’t store the full blockchain).</li><li><strong>total=25</strong>: Total is just ETH + LES (in this case, 25).</li></ul><p>The more peers Geth connects with, the faster it can sync the blockchain.</p><h4>2. Starting the Node</h4><p><strong>Starting peer-to-peer node .... instance=Geth/v1.8.21-stable-9dc5d1a9/linux-amd64/go1.11.4</strong></p><p>This tells you about the Geth instance you’re running.</p><ul><li><strong>Version</strong>: v1.8.21-stable is your Geth version.</li><li><strong>Platform</strong>: linux-amd64 means it&#39;s the 64-bit version running on Linux. If you were running the 32-bit version, you’d face memory issues. For example, while mining or importing blocks, the 32-bit version might crash because it can’t handle big memory loads. Always stick to 64-bit if you can.</li><li><strong>Go Version</strong>: go1.11.4 shows it’s compiled with Go version 1.11.4.</li></ul><p>💡 <strong>Heads-up</strong>: Geth doesn’t auto-update, so when a new version comes out, you’ll need to update it manually.</p><h4>3. Cache and Chain Data</h4><p><strong>Allocated cache and file handles...... database=/home/sammy/.ethereum/geth/chaindata cache=512 handles=536870908</strong></p><p>This tells you where Geth is storing the blockchain.</p><ul><li><strong>database=/home/sammy/.ethereum/geth/chaindata</strong>: This is the folder where your blockchain data is saved. If you ever need to clear it (e.g., for a fresh sync), you’d delete this folder.</li><li><strong>cache=512</strong>: Geth is using 512 MB of cache memory for faster data access.</li><li><strong>handles=536870908</strong>: This refers to the maximum number of file handles that can be opened. It&#39;s a Linux system thing and generally not something you need to tweak.</li></ul><h4>4. Chain Initialization</h4><p><strong>Initialised chain configuration config={ChainID: 1 Homestead: 1150000 ...}</strong></p><ul><li><strong>ChainID: 1</strong>: This tells you that you’re connected to the Ethereum mainnet (the real network). If it said something like 1337, you’d be on a private or test network.</li><li><strong>Homestead, Byzantium, Constantinople</strong>: These are Ethereum’s major upgrades (called hard forks). The log shows the block numbers where each upgrade was activated.</li></ul><h4>5. P2P Networking</h4><p><strong>Started P2P networking .... self=enode://fafa...@127.0.0.1:30303</strong></p><p>This is your node’s identity on the Ethereum network. Other nodes use this <strong>enode</strong> address to connect to you. It includes your IP (127.0.0.1), UDP port (30303), and TCP port (30303).</p><h4>6. IPC Endpoint</h4><p><strong>IPC endpoint opened .... url=/home/sammy/.ethereum/geth.ipc</strong></p><p>This means Geth has opened an <strong>IPC (Inter-Process Communication)</strong> endpoint. You can use tools like geth attach or libraries like Web3.js to interact with this endpoint and send commands to your node.</p><h3>Connect to a Running Geth Instance</h3><p>When Geth is running, it creates an IPC file (a way for processes to communicate).</p><p>If you start Geth the usual way without adding any extra parameters it’ll show you the IPC endpoint in the logs. For example:</p><p><strong>url=/home/sammy/.ethereum/geth.ipc</strong></p><p>On <strong>Windows</strong>, this endpoint is actually a named pipe, and you don’t have to worry about where it’s located. You can connect to the Geth instance from anywhere in the OS without needing to think about the file.</p><p>But on <strong>Linux</strong> or <strong>Mac</strong>, the IPC file location actually matters. You’ll need to know where it is because the tools you use to connect to Geth (like geth attach or Web3.js) will require the full path to the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0JTE26hwq0wtBrgO8wYACA.png" /><figcaption>ss3</figcaption></figure><p>If you’re on Linux and want to connect to your running Geth instance from another terminal, you can use the geth attach command. This basically puts Geth into &quot;client mode.&quot;</p><p>The Geth process that’s already running is like a server, accepting connections from other processes or terminals. By typing geth attach, you’re attaching to that running instance. When you do this, it’ll greet you with something like &quot;Welcome to the Geth console.&quot;</p><p>The console shows details like:</p><ul><li>The instance you’re connected to (e.g., version info)</li><li>The data directory where everything is stored</li><li>Available modules (like admin, web3, personal, etc.)</li></ul><p>Now, if you’re on Linux or Mac (like me), you’ll need the IPC endpoint to attach. Look at the log for the path (e.g., /home/sammy/.ethereum/geth.ipc) and run this command:</p><pre>geth attach ipc:/home/sammy/.ethereum/geth.ipc</pre><p>That’s it! You’re now connected to the same Geth instance and can interact with it. Pretty simple!!</p><h3>Working with the JSON RPC API</h3><p>Alright, so we’ve got the server running, the client connected, and everything’s set up. Now let’s interact with it. There are a bunch of modules available, like admin, debug, eth, ethash, miner, net, and a ton of others.</p><p>What I’m gonna show you is how to create a new account using the Geth console. It’s super simple. You just type: personal.newAccount();</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPtaz1UbX1GR6LP4UWnE7w.png" /><figcaption>ss4</figcaption></figure><p>This is a JavaScript command, it’s literally calling a function. When you do this, it’ll ask you to type in a passphrase. If you’ve used Linux, you’re probably familiar with this kind of thing.</p><p>Once you enter the passphrase, Geth will create a new account for you. But here’s the question one would ask: <strong>Where are these accounts stored?</strong></p><p>Well, Geth saves them in a file-based database located in your home directory under a hidden folder called .ethereum. Since the folder name starts with a dot, it won’t show up in a normal ls command. You’ll need to type: ls -la to see hidden files.</p><p>If you notice, the Ethereum address shown in both terminals is the same. The only difference is that one is in lowercase and the other in uppercase. That’s just how Geth handles things, it doesn’t really matter since Ethereum addresses aren’t case-sensitive.</p><p>So, when you’re interacting with the Geth console, that’s essentially what’s happening behind the scenes.</p><p>Now, if you head over to the Ethereum GitHub repository, there’s a section for developer/management APIs. You’ll find a full list of management APIs there. There’s also another endpoint called <strong>JSON RPC</strong>. This is the one that handles all the interactions with the blockchain.</p><p>JSON RPC is the endpoint used by browsers, web3 libraries, and basically any tool that interacts with the Ethereum blockchain. And in the case of Ethereum, this typically happens through the eth module.</p><p>In general, you can do everything blockchain-related directly from the command line. But at some point, you’ll want a cleaner, user-friendly way to interact with the blockchain. That’s where dApps (decentralized apps) come into play.</p><p>With tools like <strong>web3.js</strong> (a JavaScript library), you can connect your dApp to the blockchain. This removes the need for command-line interactions altogether. Instead, you’ll have a cool UI that users can interact with while web3.js handles all the blockchain stuff in the background.</p><p>Before we start setting up a Genesis block, we need to talk about the three different types of blockchains.</p><h3>Types of Blockchains</h3><p>All blockchain systems are similar in their inner workings and required functionality but differ in the way new network participants (nodes) join a network:</p><ul><li>Public (permissionless)</li><li>Private (permissioned)</li><li>Consortium-controlled (permissioned)</li></ul><h4>Public Blockchains</h4><p>As their name indicates, public blockchains are public, so anyone can join them from anywhere. This contrasts with permissioned systems, where access to all the network access points is individually controlled. Furthermore, new participants are unvetted, and there are no measures anyone can take to exclude a node from the network at any time. No one is responsible, and anyone can participate in reading, writing, and verifying the blockchain. Another property of this type of blockchain is that it is open and transparent. Each node in the network can review any entry from any time. The most prominent examples of public blockchains today are the Bitcoin and Ethereum networks.</p><h4>Private Blockchains</h4><p>Private blockchains require explicit pre-veriﬁcation of all network nodes. Given that there is a central point of control, there is a common notion that private blockchains are inferior to public (permissionless) blockchains because they have a single point of failure. Since all participating parties that run nodes in these blockchains are usually known to each other, trust is not a central concern, limiting the use cases for private blockchains. Enterprises that are particularly concerned with data privacy and control, rather than technical design, tend to use private blockchains, the most prominent of which are Ripple and Hyperledger.</p><h4>Consortium-Controlled Blockchains</h4><p>Consortium-controlled blockchains are an extension of the private blockchain setup, as they remove the centralized autonomy that is prevalent in the case of private blockchains. For example, a consortium could consist of thirty ﬁnancial institutions or any number which specify that decisions made in the network are accepted as valid only if more than half of the participating institutions conﬁrm it. In that sense, more than one person or company is responsible for the network. The most prominent example of a consortium-operated blockchain today is Corda by R3.</p><h3>Setting Up genesis.json Using Puppeth</h3><p>Next you will conﬁgure and launch a private Ethereum network using the puppeth command. This step will include creating the ﬁrst block of our own blockchain (hence, the name “genesis”). The genesis block forms the foundation of any blockchain system and is the prototype of all other blocks in the blockchain. The puppeth command is used to assemble and maintain private networks: <em>puppeth</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*nFgSN-DNjwFWG5SIIt03LQ.png" /><figcaption>puppeth ss0</figcaption></figure><p>Next, you will be prompted to specify an Ethereum network name, type node_pow</p><p>Please specify a network name to administer (no spaces or hyphens, please)<br>&gt; node_pow</p><p>Next, you will be prompted to select an action; choose 2 to conﬁgure a new genesis.<br>What would you like to do? (default = stats)<br>1. Show network stats<br>2. Configure new genesis<br>3. Track new remote server<br>4. Deploy network components<br>&gt; 2</p><p>Next, you will be prompted to specify what you want to do; choose 1 to create a new genesis block from scratch.</p><p>What would you like to do? (default = create)<br>1. Create new genesis block from scratch<br>2. Import already existing genesis<br>&gt; 1</p><p>Next, you will be prompted to select a consensus algorithm; choose 1 to use proof-of-work (PoW):</p><p>Which consensus engine to use? (default = clique)<br>1. Ethash — proof-of-work<br>2. Clique — proof-of-authority<br>&gt; 1</p><p>Next, you will be prompted to specify pre-funded accounts. Copy and paste the ﬁrst address that you set up in step (d) so it gets pre-funded.</p><p>Which accounts should be pre-funded? (advisable at least one)<br>&gt; 0xe9c51fb5f23321142ee20e991413b956e1c5fbc6<br>&gt; 0x</p><p>You will now be asked if you want to pre-fund your initial address with 1 wei; type yes and press enter to pre-fund the address.</p><p>Should the precompile-addresses (0x1 .. 0xff) be pre-funded with 1 wei? (advisable yes)<br>&gt; yes</p><p>Next, you will be prompted to specify a network identiﬁer; type 101 and press enter:</p><p>Specify your chain/network ID if you want an explicit one (default = random)<br>&gt; 101</p><p>Next, you will be prompted to select an action; choose 2 to manage the existing genesis.</p><p>What would you like to do? (default = stats)<br>1. Show network stats<br>2. Manage existing genesis<br>3. Track new remote server<br>4. Deploy network components<br>&gt; 2</p><p>Next, you will be prompted to select an action; choose 2 to export the genesis.<br>1. Modify existing fork rules<br>2. Export genesis configuration<br>3. Remove genesis configuration<br>&gt; 2</p><p>You will now be prompted to select a folder in which to save the genesis specs; press enter to select the default (current) folder.</p><p>Which folder to save the genesis specs into? (default = current)<br>Will create node_pow.json, node_pow-aleth.json, node_pow-harmony.json, node_pow, parity.json</p><p>Next, you will be prompted to select an action, press the key combination Control + C to exit Geth; after that, you should again see the root@… command prompt.</p><p>What would you like to do? (default = stats)<br>1. Show network stats<br>2. Manage existing genesis<br>3. Track new remote server<br>4. Deploy network components<br>&gt; ^C</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*qpVYprarAWcqNkZJ4AoBGg.png" /><figcaption>puppeth ss1</figcaption></figure><h3>Create Your Own Private Network and Mine</h3><p>In this section, we’ll go over how to create your own private Ethereum network and the genesis JSON file. First, use geth to start a new network with your configured genesis file by running: geth init node_pow.json --datadir node_pow</p><p>Next, start mining the first block on your private blockchain with this command: geth --datadir node_pow --mine --miner.threads 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkmDe17I1eEUJRmNxXIvWw.png" /><figcaption>ss6</figcaption></figure><p>When you start the network for the first time, it will need to create a DAG file. (We won’t dive into the technical details of DAG files here.) The DAG file serves two main purposes: <strong>(1)</strong> To make mining ASIC-resistant (so people can’t use special mining hardware). <strong>(2)</strong> To make it easier for clients to verify mined blocks without too much computational load.</p><p>Depending on your hardware, generating the DAG file might take up to 30 minutes. While it’s being created, you should see something like this on your output screen:</p><p>Once the DAG file is created, your client node will start mining automatically. You’ll see regular output for each block being mined. Congrats you’re mining your own blockchain!</p><p>After mining a few blocks, you can exit the Geth console by pressing Ctrl + C.</p><p>Now, you’ll want to get back into the Geth console in interactive mode so you can start typing commands to interact with your blockchain. To do that, use the following command: geth --verbosity 2 console --datadir node_pow --mine --miner.threads 1 --nousb</p><p>Finally, let’s stop the miner before moving on to the next exercises. You can stop the miner anytime by running this command: miner.stop();</p><p>If you want to check if your blockchain is being mined, you can use this command at any point: eth.mining</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d1WJFcjuyOo9CFKW8WJTPQ.png" /><figcaption>ss9</figcaption></figure><h3>Sending Funds With/Without a Transaction Fee</h3><p>Now we will move to funds between the accounts, and demonstrate different scenarios and their impact (e.g., sending funds with and without a transaction fee). Throughout the exercises, we will periodically analyze the chart of accounts on our blockchain (i.e., review how much money is associated with each address). Following the money in this fashion will allow the reader to obtain a hands-on understanding of how funds move within the blockchain realm. Finally, we will look at one of the blocks containing one of the exercise transactions to provide a concrete example of exactly what data is captured as part of the transaction.</p><p>If you completed the above exercises. you can continue from here. Otherwise, please complete (or redo) all the steps from above. For all the steps in this section, we assume that we are set up and ready to go with a PoW-based setup.</p><p>As a ﬁrst step, we will re-launch the geth console. The command below launches the Geth console in an interactive mode and with limited verbosity, meaning we will not see all of the mining output.</p><p>geth --verbosity 2 console --datadir node_pow --mine --miner.threads 1 --nousb</p><h4>Accounts and balances</h4><p>At any point, you can look at what accounts are on your blockchain; this is helpful for this exercise because you can track them individually. Once a transaction involving one or more of your accounts occurs, these changes will be captured on the actual blockchain as well. To see what accounts exist already, you can use the personal.listAccounts command from within the Geth terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pzMR_cd5Mh4-iY7nWhHCOQ.png" /><figcaption>ss10</figcaption></figure><p>As above, you should be seeing two accounts. These are the two accounts that you created and pre-funded as part of the above exercises. As a next step, let us validate the value contained in each of these two accounts. For this, you will use the web3.eth.getBalance command.</p><p>Next, using the getBalance command, you can check the account balance of your individual accounts; it will be displayed in wei, the smallest unit in the Ether realm. For simplicity, you can write the same prompt by referencing one of your accounts via a parameter and the personal.listAccounts function; this will yield the same result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0VMfcuCyE3_NzLxxsGSG1g.png" /><figcaption>ss11</figcaption></figure><h4>Your ﬁrst transaction</h4><p>Before we create our ﬁrst transaction, we will create an additional account. This account will not be pre-funded, making it easier for us to validate whether a transaction took place. From the Geth console, use the following command to create a new account: personal.newAccount()</p><p>At any point, you can look again at what accounts exist; there should now be three accounts: the two accounts that you created above and the new (empty) account that you just created: personal.listAccounts</p><p>Next, using the getBalance command, you can verify that the latest account does not contain any ether: web3.eth.getBalance(“0x…”). For simplicity, you can write the same prompt by referencing one of your accounts via a parameter and the personal.listAccounts function; this will yield the same result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6ZU4BqEb8gQfUS5H4RFPA.png" /><figcaption>ss12</figcaption></figure><p>Note also that you can use the “from wei” function to convert this number into Ether: web3.fromWei(web3.eth.getBalance(personal.listAccounts[0])),”Ether”)</p><p>Next, we will execute our ﬁrst transaction. For this, we need both a sender and a receiver address, as well as the private key of the sender. In the Geth command line, creating a new transaction works as follows:</p><pre>web3.eth.sendTransaction(<br>{<br>    from:personal.listAccounts[0],<br>    to:personal.listAccounts[2],<br>    value:1000<br>}<br>);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*sv0nYTN4c6rrBT1zbK-urg.png" /><figcaption>ss13</figcaption></figure><p>After trying this command, you will notice an error because you need to unlock the sender account ﬁrst. To do this, use the following prompt (and the password you set when you created this address). Now you should be able to conduct the transaction using web3.eth.sendTransaction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*yF6MrT4o78VE3S6B0pMe2Q.png" /><figcaption>ss14</figcaption></figure><p>The number displayed is the transaction hash; it can be used to identify any transaction conducted on the blockchain.</p><h4>Transaction validation</h4><p>Next, let us re-validate the balance of both accounts to conﬁrm that the transaction was carried out: web3.eth.getBalance(personal.listAccounts[2]);</p><p>Hold on. What happened here? The balance in your sender accounts is still what it was before! This is because you were not mining the blockchain. For the transaction to actually occur, you need ﬁrst to start the mining process. At any point in time, you can use the following command to determine if your blockchain is actually being mined: eth.mining</p><p>Before we move to launch the mining process so we can ﬁnally send our transaction, let us look at the open transaction pool. Remember, these are the open transactions that have not yet been mined and so are not yet part of the blockchain. Next, we will start the mining process using the following command (if not started): miner.start(); and You can stop the miner again with the following command: miner.stop();</p><p>At this point, we assume that our transaction was (1) mined, (2) included in a block, and (3) removed from the open transaction pool. Let’s continue to validate these assumptions next. As you can see from the output, the open transaction pool is now empty; there are no pending transactions awaiting validation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tz0IR54l2OtIDAJv7MpTGQ.png" /><figcaption>ss15</figcaption></figure><p>Success! We can now see that the speciﬁed amount of 1,000 wei was transferred from our ﬁrst personal account and sent to the third personal account we created.</p><h3>Tips and Tricks with Geth</h3><p>Now that everything is set up! your network is initialized, you’ve created an account, you know how to start mining, and you see ethers rolling into your account! noice. now, I want to show you a few tips.</p><p>As you can see, having two windows open, starting Geth, switching to another window, attaching to it, starting the miner, and so on can be a bit inconvenient. What I usually do is close one window. I don’t want to attach anything, so I just open a new window and start Geth directly. This way, it unlocks my account, and I can work with my blockchain from the start, using the account I want.</p><p>To do this, I run Geth with the following commands:</p><ul><li>--datadir</li><li>--nodediscover</li><li>--unlock (to unlock my first account)</li><li>--mine (to start mining)</li></ul><p>Once I do this, I’ll see the usual log output from Geth, and somewhere in the middle, it will ask for my passphrase. It will stop there until I type it in, and then it will continue.</p><p>Thanks for reading! Next, we’ll dive into more advanced topics, like participating in the actual Ethereum and Bitcoin networks as a miner/validator/node, creating a dApp, and much more.</p><h4>You can check out my other articles:</h4><ul><li><a href="https://blog.blockmagnates.com/building-and-testing-your-first-erc20-token-a-hands-on-guide-946eb89b833b">Building and Testing Your First ERC20 Token: A Hands-On Guide</a></li><li><a href="https://coinsbench.com/advanced-blockchain-mastering-how-blockchain-works-a8c2ff3fbb5f">Advanced Blockchain: Mastering How Blockchain Works v2</a></li><li><a href="https://mrnazu.medium.com/cpu-architecture-a5dc9e01ca41">CPU Architecture</a></li><li><a href="https://coinsbench.com/stop-wasting-time-setting-up-ziion-os-the-web3-devs-and-hacker-s-dream-936801497f65">Stop Wasting Time Setting Up! ZIION OS, The Web3 Dev’s and Hacker’s Dream :)</a></li></ul><blockquote><em>Want to get into DeFi yield and airdrop farming? Don’t have time? Don’t know where to start?</em></blockquote><blockquote><a href="https://oneclickfi.notion.site/101df4bdd2cd4f428870ce0486bc41ca">Join our newsletter and private group of 300+ DeFi farmers</a> for simple, top 5-minute yield opportunities — plus get our 400+ airdrop database as a bonus!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e345642557b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/learn-how-to-use-go-ethereum-and-puppeth-7e345642557b">Learn How to Use Go-Ethereum and Puppeth</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CPU Architecture]]></title>
            <link>https://mrnazu.medium.com/cpu-architecture-a5dc9e01ca41?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5dc9e01ca41</guid>
            <category><![CDATA[cpu-architecture]]></category>
            <category><![CDATA[computer-architecture]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[cpu]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 14:53:23 GMT</pubDate>
            <atom:updated>2024-12-20T14:53:23.752Z</atom:updated>
            <content:encoded><![CDATA[<p>You’re probably someone who’s trying to understand programming and computers. You might even own a computer, but do you really know how it works? Its history? How different geniuses shaped it? Or the core ideas behind computer design and architecture? If this sounds like you, this article is for you.</p><p>Many of us jump into learning a new programming language with one YouTube course and feel like we’ve got it all figured out. But in reality, we don’t. We miss the bigger picture or the core side: how programs actually run on a computer, how they’re stored, or even how programming languages themselves were created. Think about it: how do you build a programming language from scratch when no language existed before? It’s not as simple as it sounds.</p><p>This is why I believe your coding journey shouldn’t just start with high-level languages like Python or JavaScript. If you only focus on these, you’ll likely end up knowing the syntax but having no real understanding of computers or programming fundamentals. Syntax is just the surface. Real software engineers and computer scientists dig deeper.</p><p>You might say, “I just want to be a developer, so I don’t need to know all that low-level stuff.” But that’s like trying to speak English without understanding basic grammar. Sure, you can memorize phrases, but an expert will immediately know you lack depth. The same goes for programming: you need to understand the “grammar” of computers and programming languages, starting from the ground up.</p><p>And that’s where <strong>computer architecture</strong> comes in. It’s the foundation of everything in computing. So, let’s kick things off by looking back at how it all started, more than 75 years ago.</p><h3>Pre-Modern Computers</h3><p>Let’s talk about <strong>Colossus</strong>, the world’s first programmable electronic digital computer. It was built in 1943 at Bletchley Park in the UK to help crack codes during World War II. For years, the work done there and the Colossus itself remained a national secret.</p><p>You’ve probably heard about the American ENIAC system being credited as the first programmable computer. But in reality, Colossus came out a few years earlier, it just wasn’t public knowledge. If you’ve seen the movie <em>The Imitation Game</em> about Alan Turing, you might already know a little about Bletchley Park and why everything was kept top secret.</p><p>While Colossus was groundbreaking, it had one major limitation: it couldn’t store programs in memory, only data. To run a new program, engineers had to manually reconfigure the machine with switches and patch cables, a time-consuming process. For example, some of the early computers that came shortly after Colossus required up to three weeks just to rewire and set up for a new task.</p><p>Naturally, people started looking for ways to fix this problem. That’s where one of the greatest minds in computer science came in: <strong>John von Neumann</strong>. Von Neumann was a Hungarian-American mathematician and one of the brightest geniuses of the 20th century. He worked on many big projects, like the Manhattan Project (the team behind the atomic bomb), but his contributions to computing were just as revolutionary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EDNgf_90MEBvfYu_.jpg" /></figure><p>To solve the memory issue, Von Neumann proposed a new design in 1945 called the <strong>von Neumann architecture</strong>. This design allowed both the program and the data to be stored in the same memory. It was a game-changer. Computers built with this architecture were much easier to reprogram, and this idea became the foundation of all modern computing systems.</p><p>Even today, the core concepts of von Neumann’s design are present in everything from laptops to smartphones. To give you a quick visual, here’s a diagram to show how it works. You can also find similar examples online if you search for “von Neumann architecture.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZAnjCrHpW2zlUF36YCxdtw.png" /></figure><p>As you can see in the diagram, the <strong>memory</strong> holds both the data and the program. We also have the <strong>Control Unit (CU)</strong> and the <strong>Arithmetic Logic Unit (ALU)</strong>, along with <strong>Input/Output</strong> components. These parts are all connected using <strong>buses</strong>.</p><p>The <strong>Control Unit</strong> is like the computer’s manager: it decodes instructions and controls how data flows through the system. The <strong>ALU</strong> is the part that handles all the calculations and logical operations, like addition, subtraction, comparisons, and so on.</p><p>To move data between components, we use buses, which are essentially the “wires” that transfer information. In the diagram, the buses are represented by the arrows connecting everything together. If you’ve ever taken a close look at a motherboard, you’ll notice tiny wires running across it: those are the buses that carry data between different parts of the computer.</p><p>Another key component in the diagram is the <strong>Accumulator</strong>, which is part of the ALU. It’s a type of <strong>register</strong>, and registers are small memory locations within the CPU that serve specific purposes.</p><p>In modern computers, all these components: memory, control unit, ALU, and registers are combined into a single microchip called the <strong>CPU</strong> (Central Processing Unit). This is essentially the “brain” of the computer. The Input/Output components are what allow us to send data into the computer and get results back once everything has been processed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYVF0IWg05StmTvoZOlWoA.png" /></figure><p>So, what are Registers? well, registers are special-purpose memory locations that are separate from the main memory. While main memory can store any kind of data, registers are designed for specific tasks. Let’s look at some of the key registers: <strong>(1)</strong> <strong>Accumulator (ACC)</strong> The accumulator temporarily stores the results of calculations performed by the ALU. <strong>(2)</strong> <strong>Program Counter (PC)</strong> The program counter keeps track of the memory address of the next instruction to be executed. (Ethereum’s EVM also uses a program counter for the same purpose!) <strong>(3)</strong> <strong>Memory Address Register (MAR)</strong> The MAR holds the memory address of the data or instruction that needs to be fetched or stored. <strong>(4)</strong> <strong>Memory Data Register (MDR)</strong> The MDR holds the actual data or instruction that has been fetched from memory or is about to be written back to memory. It doesn’t store addresses: just the raw data or instructions. <strong>(5)</strong> <strong>Current Instruction Register (CIR)</strong> The CIR stores the most recently fetched instruction while it’s waiting to be decoded and executed. For example, when the MDR pulls data from memory, and it turns out to be an instruction, it’s passed to the CIR for processing.</p><p>Together, these registers help the CPU work efficiently by handling specific tasks at high speed, making sure instructions are executed in the correct order and data is processed accurately.</p><h3>Modern Computers: The CPU</h3><p>If you’ve understood the earlier explanation and diagram, then half of what we’re about to cover will already make sense. Let’s dive into the <strong>CPU</strong> (Central Processing Unit) and where it fits into a computer system.</p><p>I won’t get into too much detail about the physical aspects of a CPU: it’s a tiny component, usually just a few inches in size, mounted on the motherboard. If you’re curious, you can look up videos or images of how it fits onto the motherboard. In devices like smartphones and tablets, the CPU is miniaturized even further, often smaller than your thumb, to fit into compact circuit boards.</p><p>Now, the CPU is the “brain” of the entire computer. Its job is to fetch instructions from memory (RAM), decode them, and execute them. These instructions come from computer programs. In the future, we’ll dive deeper into how programs written in languages like Assembly, C, or even binary interact with the CPU.</p><p>The CPU itself is made up of billions of transistors. Think of transistors as tiny electronic switches that work together to form logic gates, which process both data and instructions.</p><p>The CPU’s speed is controlled by a <strong>clock</strong>, which is a tiny quartz crystal inside the chip. The clock ticks at a steady speed, and the CPU can only perform an action during each tick. Between ticks, it does nothing. During a single tick, the CPU processes one instruction.</p><p>We measure clock speed in <strong>Hertz (Hz)</strong>: <strong>(1)</strong> <strong>1 MHz (Megahertz)</strong> = 1 million cycles per second. <strong>(2) 1 GHz (Gigahertz) = 1 billion cycles per second.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*9p5bmJgJkBB7Re6Z8VkhzQ.png" /></figure><p>Modern CPUs operate at speeds around <strong>3 GHz</strong>, or 3 billion cycles per second. For example, my CPU runs at 2.11 GHz. You can check yours by right-clicking <strong>This PC</strong> on your computer, selecting <strong>Properties</strong>, and looking under the CPU section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*71tVrLRV7PBAdD_sPbdWmA.png" /></figure><h3>Cache Memory and the Fetch-Decode-Execute Cycle</h3><p>Let’s talk about something very important that wasn’t included in the earlier diagram: <strong>cache memory</strong>.</p><p>When your computer is running, the data and programs you’re actively using are stored in <strong>RAM</strong> (Random Access Memory). Your RAM size could be 4GB, 8GB, or even more: mine is 16GB. Of course, RAM is great for temporary storage, but it’s relatively slow compared to the CPU and registers. In fact, your CPU spends a lot of time waiting for data from RAM.</p><p>To address this problem, computer engineers created <strong>cache memory</strong>. Cache is a small but very fast type of memory built directly into the CPU. It’s used to store instructions or data that are frequently accessed or expected to be needed soon.</p><p>Think of cache as a middle ground between RAM and the CPU registers. It’s much smaller than RAM: usually measured in megabytes (MB) instead of gigabytes (GB): but it’s significantly faster because it’s part of the CPU itself. If we could somehow scale cache up to the size of RAM, it would make computers much faster, but for now, its smaller size is a trade-off for speed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0Tg08VumDD9wVwI1pU97Q.png" /></figure><p>Finally, let’s wrap things up with the <strong>Fetch-Decode-Execute cycle</strong>, which is the basic process the CPU follows to do its job: <strong>(1) Fetch</strong>, the CPU retrieves an instruction from memory (RAM or cache). <strong>(2) Decode</strong>, the CPU interprets the instruction to understand what needs to be done. <strong>(3) Execute,</strong> the CPU carries out the instruction, such as performing a calculation or transferring data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*CK5CroL9BvyCsUva.jpeg" /></figure><p>This cycle happens over and over as the CPU processes instructions, keeping your computer running smoothly. It’s a simple yet powerful system that underpins how computers work.</p><h3>Bonus: What Makes a Computer Fast or Slow?</h3><p>Why is one computer faster than another? We’ve already covered the basics, but let’s summarize the three main factors: <strong>(1) Clock Speed,</strong> the speed at which the CPU processes instructions, measured in gigahertz (GHz). <strong>(2) Number of Cores</strong>: More cores allow the CPU to multitask better, handling multiple processes simultaneously. <strong>(3) Cache Memory</strong>: A larger cache reduces the need to fetch data from the slower RAM, speeding up operations.</p><p>Other factors, like RAM size, hard drive type (SSD vs HDD), and GPU performance, also play a role, but the CPU is the heart of it all.</p><h4>Overclocking: Pushing Your CPU to the Limit</h4><p>What if you could make your CPU tick faster? You actually can, and it’s called <strong>overclocking</strong>. By adjusting your computer’s settings, you can push your CPU to run at a higher speed than its default. For example, my CPU runs at 2.1 GHz, but I could try overclocking it to 4 GHz to boost performance. Sounds great, right?</p><p>Well, here’s the catch: Overclocking generates extra heat. CPUs already produce enough heat to cook an egg (not literally, but close), and overclocking without proper cooling can damage or destroy your CPU. So, ofc it’s possible, it’s not always a good idea unless you have advanced cooling systems in place.</p><h4>The Role of CPU Cores</h4><p>Another factor is the <strong>number of cores</strong> in your CPU. My CPU has 7 cores, which makes it faster for multitasking. More cores mean your computer can handle multiple tasks at once: this is called <strong>parallel processing</strong>. For example, I can record my screen with OBS Studio, use my camera, and play GTA V all at the same time without slowing down. Fewer cores, on the other hand, mean less efficient multitasking.</p><p>Lastly, let’s revisit <strong>cache memory</strong>. Since the CPU is faster than RAM, having more cache memory helps reduce the time spent waiting for data from RAM. A larger cache means faster performance, especially for frequently accessed data.</p><p>This is a basic introduction to how CPUs affect your computer’s performance. If you’re curious to learn more, there are advanced books and lectures from places like MIT and Harvard that dive deep into the topic. For those focusing on building apps or websites, this knowledge is more than enough. But if you want to specialize in low-level computing, you’ll need to go beyond this.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5dc9e01ca41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building and Testing Your First ERC20 Token: A Hands-On Guide]]></title>
            <link>https://blog.blockmagnates.com/building-and-testing-your-first-erc20-token-a-hands-on-guide-946eb89b833b?source=rss-2d61b13f0e77------2</link>
            <guid isPermaLink="false">https://medium.com/p/946eb89b833b</guid>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[erc20]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[0xNazu.sol]]></dc:creator>
            <pubDate>Mon, 02 Dec 2024 16:54:16 GMT</pubDate>
            <atom:updated>2024-12-03T12:21:03.360Z</atom:updated>
            <content:encoded><![CDATA[<p>In our previous article, <strong>“Ethereum: Introduction to ERC20 Tokens,”</strong> we covered the theory behind ERC20 tokens. Now it’s time to put that knowledge into practice and master creating an ERC20 token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*VQox-0dIf3sA1qdgaOTjpg.png" /><figcaption>Source: <a href="https://www.alwin.io/">https://www.alwin.io/</a></figcaption></figure><p>Our goal in this exercise is to create an ERC20 token using OpenZeppelin’s <strong>ERC20.sol</strong> contract, deploy it to a local Hardhat chain, and test it. We’ll use three accounts for this: (1) The deployer or owner of the ERC20 token contract with User1, User2 and User3.</p><p>Now we have different tasks. The first task is to create our ERC20 contract:</p><ol><li>Import and inherit from OpenZeppelin’s ERC20.sol contract.</li><li>Choose a token <strong>name</strong> and <strong>symbol</strong>.</li><li>Set the contract owner when deploying.</li><li>Implement an external mint() function that only the owner can call.</li></ol><p>Once the contract is ready (and that’s a big step, congrats in advance!), we’ll move on to testing it. Here’s what we’ll do:</p><ol><li>Deploy the contract from the <strong>deployer</strong> account.</li><li>Mint <strong>100K tokens</strong> to the deployer (ourselves).</li><li>Mint <strong>5K tokens</strong> for each user (User1, User2, and User3).</li><li>Verify with a test that every user has the right token balance.</li><li>Transfer <strong>100 tokens</strong> from User2 to User3.</li><li>From User3, approve User1 to spend <strong>1K tokens</strong> on their behalf.</li><li>Test that User1 has the correct allowance from User3.</li><li>From User1, use transferFrom() to move <strong>1K tokens</strong> from User3 to User1.</li><li>Verify with a test that all users have the correct final balances.</li></ol><h3>Solution:</h3><p>So, I started by creating a file called MyToken.sol. Since I have no clue beyond adding the version and creating the contract class, I had to rely on documentation to figure things out. For this, I’ll use:</p><ol><li>The <strong>ERC20 Standard</strong> on the Ethereum website</li><li>The <strong>ERC20 source code</strong> on GitHub.</li><li><strong>Hardhat tests</strong> to make sure everything works.</li></ol><p>Let’s see how it goes!</p><p>So, as always, we start with SPDX-License-Identifier: MIT. Why do we do that? Well, you’ll need to check out our first Solidity article to understand that.</p><p>After declaring the version, we import the ERC20 contract from OpenZeppelin. Then, we create a new smart contract called MyToken. Using the is keyword, we inherit from ERC20. By doing this, MyToken now has everything from ERC20. It doesn’t actually &quot;implement&quot; ERC20 (because that’s already done by OpenZeppelin), but it includes all its functionality.</p><p>Boom, task one is already done. Awesome!</p><p>Now, we need to pick a name and symbol for our token. To do that, we create a constructor. By calling the ERC20 constructor, we can pass in the name and symbol during deployment.</p><p>Next, we need to set a contract owner when the token is deployed. Why? Because we’ll need it for later tasks. So, here’s what we do:</p><ol><li>Define a public owner variable of type address.</li><li>In the constructor function, set the owner to msg.sender.</li></ol><p>And that’s it. Task 3 is done!</p><p>Now for Task 4, we need to implement an external mint() function that only the owner can call.</p><p>Here’s how we do it:</p><ul><li>Create a new function called mint().</li><li>It takes two parameters: an address (to) and an amount.</li><li>Mark it as external so it can be called from outside the contract.</li><li>Use a check to ensure only the owner can call this function.</li></ul><p>And that’s it! We’ve created our token with an owner. Congrats!<br>Here’s the full code:</p><pre>// SPDX-License-Identifier: MIT<br>pragma solidity ^0.8.13;<br><br>import {ERC20} from &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;<br><br>contract MyToken is ERC20 {<br>    address public owner;<br>    constructor() ERC20(&quot;My Token&quot;, &quot;MTN&quot;) {<br>        owner = msg.sender;<br>    }<br>    function mint(address _to, uint _amount) external {<br>        require(msg.sender == owner, &quot;Not Owner&quot;);<br>        _mint(_to, _amount);<br>    }<br>}</pre><h3>Testing</h3><p>Now we’ve got our own test here:</p><pre>const { ethers } = require(&#39;hardhat&#39;);<br>const { expect } = require(&#39;chai&#39;);<br><br>describe(&#39;ERC20 Tokens Exercise 1&#39;, function () {<br>    <br>    let deployer, user1, user2, user3;<br>    // Constants <br>    const DEPLOYER_MINT = ethers.utils.parseEther(&#39;100000&#39;);<br>    const USERS_MINT = ethers.utils.parseEther(&#39;5000&#39;);<br>    const FIRST_TRANSFER = ethers.utils.parseEther(&#39;100&#39;);<br>    const SECOND_TRANSFER = ethers.utils.parseEther(&#39;1000&#39;);<br>    before(async function () {<br>        /** Deployment and minting tests */<br>        <br>        [deployer, user1, user2, user3] = await ethers.getSigners();<br>        // Contract deployment<br>        const MyTokenFactory = await ethers.getContractFactory(<br>            &#39;contracts/erc20-1/MyToken.sol:MyToken&#39;,<br>            deployer<br>        );<br>        this.token = await MyTokenFactory.deploy();<br>        <br>        // Minting<br>        await this.token.mint(deployer.address, DEPLOYER_MINT)<br>        await this.token.mint(user1.address, USERS_MINT)<br>        await this.token.mint(user2.address, USERS_MINT)<br>        await this.token.mint(user3.address, USERS_MINT)<br>        <br>        // Check Minting<br>        expect(await this.token.balanceOf(deployer.address)).to.equal(DEPLOYER_MINT);<br>        expect(await this.token.balanceOf(user2.address)).to.equal(USERS_MINT);<br>    });<br>    it(&#39;Transfer tests&#39;, async function () {<br>        /** Transfers Tests */<br>        // First transfer<br>        await this.token.connect(user2).transfer(user3.address, FIRST_TRANSFER);<br>        // Approval &amp; Allowance test<br>        await this.token.connect(user3).approve(user1.address, SECOND_TRANSFER);<br>        expect(await this.token.allowance(user3.address, user1.address)).to.equal(SECOND_TRANSFER);<br>        // Second transfer<br>        await this.token.connect(user1).transferFrom(user3.address, user1.address, SECOND_TRANSFER);<br>        // Checking balances after transfer<br>        expect(await this.token.balanceOf(user1.address)).to.equal(<br>            USERS_MINT.add(SECOND_TRANSFER)<br>        );<br>        expect(await this.token.balanceOf(user2.address)).to.equal(<br>            USERS_MINT.sub(FIRST_TRANSFER)<br>        );<br>        expect(await this.token.balanceOf(user3.address)).to.equal(<br>            USERS_MINT.add(FIRST_TRANSFER).sub(SECOND_TRANSFER)<br>        );<br>    });<br>});</pre><p>All the tests passed successfully!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=946eb89b833b" width="1" height="1" alt=""><hr><p><a href="https://blog.blockmagnates.com/building-and-testing-your-first-erc20-token-a-hands-on-guide-946eb89b833b">Building and Testing Your First ERC20 Token: A Hands-On Guide</a> was originally published in <a href="https://blog.blockmagnates.com/">Block Magnates</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>