Marcin Jahn | Dev Notebook
  • Home
  • Programming
  • Technologies
  • Projects
  • About
  • Home
  • Programming
  • Technologies
  • Projects
  • About
  • An icon of the Networking section Networking
    • HTTP Protocol
    • OSI Model
    • TCP Procol
    • UDP Protocol
    • WebSocket
    • HSTS
    • DNS
    • Server Name Indication
    • gRPC
  • An icon of the Security section Security
    • OAuth2
      • Sender Constraint
    • Cryptography
      • Cryptography Basics
    • TPM
      • Overiew
      • TPM Entities
      • TPM Operations
  • An icon of the Linux section Linux
    • Gist of Linux Tooling
    • Unknown
    • SELinux
    • Containers
    • Bash Scripting
    • Linux From Scratch
    • Networking
  • An icon of the Kubernetes section Kubernetes
    • Meaning and Purpose
    • Cluster
    • Dev Environment
    • Kubernetes API
    • Objects
    • Pods
    • Scaling
    • Events
    • Storage
    • Configuration
    • Organizing Objects
    • Services
    • Ingress
    • Helm
  • An icon of the Observability section Observability
    • Tracing
  • An icon of the Databases section Databases
    • ACID
    • Glossary
    • Index
    • B-Tree and B+Tree
    • Partitioning and Sharding
    • Concurrency
    • Database Tips
  • An icon of the SQL Server section SQL Server
    • Overview
    • T-SQL
  • An icon of the MongoDB section MongoDB
    • NoSQL Overview
    • MongoDB Overview
    • CRUD
    • Free Text Search
  • An icon of the Elasticsearch section Elasticsearch
    • Overview
  • An icon of the Git section Git
    • Git
  • An icon of the Ansible section Ansible
    • Ansible
  • An icon of the Azure section Azure
    • Table Storage
    • Microsoft Identity
  • An icon of the Google Cloud section Google Cloud
    • Overview
  • An icon of the Blockchain section Blockchain
    • Overview
    • Smart Contracts
    • Solidity
    • Dapps
  • Home Assistant
    • Home Assistant Tips
  • An icon of the Networking section Networking
    • HTTP Protocol
    • OSI Model
    • TCP Procol
    • UDP Protocol
    • WebSocket
    • HSTS
    • DNS
    • Server Name Indication
    • gRPC
  • An icon of the Security section Security
    • OAuth2
      • Sender Constraint
    • Cryptography
      • Cryptography Basics
    • TPM
      • Overiew
      • TPM Entities
      • TPM Operations
  • An icon of the Linux section Linux
    • Gist of Linux Tooling
    • Unknown
    • SELinux
    • Containers
    • Bash Scripting
    • Linux From Scratch
    • Networking
  • An icon of the Kubernetes section Kubernetes
    • Meaning and Purpose
    • Cluster
    • Dev Environment
    • Kubernetes API
    • Objects
    • Pods
    • Scaling
    • Events
    • Storage
    • Configuration
    • Organizing Objects
    • Services
    • Ingress
    • Helm
  • An icon of the Observability section Observability
    • Tracing
  • An icon of the Databases section Databases
    • ACID
    • Glossary
    • Index
    • B-Tree and B+Tree
    • Partitioning and Sharding
    • Concurrency
    • Database Tips
  • An icon of the SQL Server section SQL Server
    • Overview
    • T-SQL
  • An icon of the MongoDB section MongoDB
    • NoSQL Overview
    • MongoDB Overview
    • CRUD
    • Free Text Search
  • An icon of the Elasticsearch section Elasticsearch
    • Overview
  • An icon of the Git section Git
    • Git
  • An icon of the Ansible section Ansible
    • Ansible
  • An icon of the Azure section Azure
    • Table Storage
    • Microsoft Identity
  • An icon of the Google Cloud section Google Cloud
    • Overview
  • An icon of the Blockchain section Blockchain
    • Overview
    • Smart Contracts
    • Solidity
    • Dapps
  • Home Assistant
    • Home Assistant Tips

Overview

Blockchain is a chain of blocks (duh). Each block contains a varying number of transactions.

A transaction contains:

  • executed operations
  • data of these operations
  • sender
  • receiver
  • transaction fee
  • timestamp

Transactions are peer-to-peer. No central entity looks over every transaction (like a bank). If I want to send money (or another asset), I can send it to them directly, without any intermediary. Transactions are also trackable and irreversible.

The chain is immutable, and the blocks are immutable. This is the main strength of blockchain. Once some transaction is registered, it stays there forever. Every block contains a has of the previous block (exception from this rule is the Genesis block - first block in the chain).

Blockchain is decentralized - every participant has the full copy of the blockchain.

Blockchain enables trust in a decentralized system of transacting peer participants. The purpose of blockchain is to verify and validate (or reject) transactions and then execute them and record the proof of these actions with the consensus of the peer participants.

Keywords

Decentralised vs Distributed

A decentralised system is a subset of a distributed system. The main difference comes down to where the decision is made and how the distribution of the decision is sent across various nodes in the system.

Decentralised means that a decision is made across various nodes. Each node decides its behaviour, which ultimately affects the system’s behaviour. This ensures that no single node has complete system information. The decision making is not restricted to a single node. The best example of a decentralised system is Bitcoin and Ethereum. Bitcoin has a decentralised network, where no government or entity has control over it. Ethereum offers a decentralised blockchain where anyone can publish dapps that connect users and providers directly.

In a distributed system, all parts of the system are located in different physical locations. The processing is spread across multiple nodes, but decision making can be centralised or decentralised. Various nodes can communicate and coordinate by passing messages. Distributed blockchain systems are more secure as the system is spread across various nodes. A great example of a distributed system is AWS or cloud instances. Instead of data being stored in one single point, it is spread across various points across the server. Even if one node fails in these networks, it will not affect the entire system.

Validation vs verification

Verification is about general rules. Validation is about application-specific rules.

Trust

Trust is a measure of confidence in the credibility of a peer participant in a system. In a blockchain, trust is established by verification and validation of participant data and transactions.

Integrity

In the blockchain context, integrity is about ensuring security and privacy of data and confidentiality of transactions.

In blockchain, participants are identified by an account number.

Bitcoin vs Ethereum

Bitcoin is just a currency. Its only application is a wallet. Ethereum (and some other blockchains) allow using blockchain technology for verification, validation and recording of transactions of other digital assets. Applications may be created on top of the Ethereum protocol (smart contracts).

All Bitcoin transactions are about sending value. Ethereum transaction embeds a function implemented by a smart contract.

Ethereum has a few networks. When deploying smart contracts they end up in one of these networks.

Accounts

All blockchain participants (including smart contracts) have an account number that uniquely identifies them. They are 160 bits (40 bytes) long. All accounts can hold a balance of ethers. Thus, there are two implicit attributes of an account: a number and a balance.

There are two kinds of accounts:

  • externally owned accounts (EOA)
  • smart contract accounts

They both can invoke smart contract function by sending a message. Such a message would contain: a sender and a value. The value is added to the balance held by the smart contract. The smart contract needs to have payable modifier (rule) to be eligible to receive funds.

Each account has a unique number (160 bits). That number is a result of hashing a public key from an asymmetric key pair of an account.

Transactions initiated from an account are signed with the private key of that account.

Networks

There are many Ethereum networks. The one with Network ID = 1 is the main network where real ETHs are being used. There are also test networks where mock ETH is used (like Ropsten). We can also set up local dev networks for testing.

Source Material

  • The “Blockchain in Action” book by Bina Ramamurthy
Smart Contracts  →
© 2023 Marcin Jahn | Dev Notebook | All Rights Reserved. | Built with Astro.