Blockchain Basics in Detail
- #Security
- #Encryption
- #Learning
- #Know-how
- 2019/12/01
Introduction
This article targets people who have not studied blockchain yet, find it intimidating, or just started learning.
Agenda
- What is blockchain?
- What is a P2P network?
- What are the core cryptographic techniques?
- What is a consensus algorithm?
- Languages, libraries, and tools
- Closing thoughts
- References
What is blockchain?
First, blockchain and cryptocurrency are different. Blockchain combines four pillars:
- Cryptography
- Peer-to-peer networking
- Consensus algorithms
- Smart contracts
It uses DLT (Distributed Ledger Technology) to make transaction history tamper-resistant. A block bundles transactions and contains the previous block’s hash, so altering one block would require rewriting every block above it. DLT shares and stores history across the P2P network, keeping the network safe.
Keep in mind that blockchain networks usually have public nets (mainnet), private nets, and test nets.
Cryptocurrency
Bitcoin (BTC), Ethereum (ETH), NEM, Ripple (XRP), etc., aim to become alternatives to fiat currency. Each has different goals.
- Bitcoin – The first cryptocurrency, based on a paper posted by someone named Satoshi Nakamoto. It still has the most transaction volume. Units: bitcoin or satoshi.
- Ethereum – Runs programs (smart contracts) on the Ethereum blockchain so you can build systems on-chain. Executing code consumes the coin you hold. Units: ether or wei.
- NEM – Short for New Economic Movement. Focuses on building economic activity.
- Ripple (XRP) – Applies blockchain ideas to international remittances. Often used as a bridge currency (e.g., JPY ⇒ XRP ⇒ USD).
Each coin has its own philosophy and algorithm, so the world of crypto is deep.
Centralized vs. decentralized
Traditional systems are centralized: client-server models where the server dictates rules and permissions. Blockchain targets decentralized systems. If you tried to build a version of Uber on blockchain, driver ratings or fares would be computed by protocol rules and smart contracts, not by a central DB. The underlying platforms (Ethereum, etc.) are OSS, reducing the chance of foul play.
P2P networks
P2P = peer-to-peer: computers connect as equals rather than through a central server. Imagine a circle of computers sharing a file via Bluetooth—they authenticate one another and share resources. Each computer that joins strengthens the network because data is distributed everywhere. With HTTP, a single server failure leads to downtime; with P2P, any peer can respond as long as one copy survives.
Cryptographic building blocks
Blockchain relies on:
- SHA-256
- RIPEMD-160
- Public-key cryptography
SHA-256 and RIPEMD-160 are hash functions (often combined as Hash160). A hash function generates a fixed-length random-looking value and is one-way—you cannot derive the original input. Many systems use it: login passwords are stored as hashes; Git commit IDs are hashes. Because a hash is deterministic for the same input, it is perfect for integrity checks.
Public-key cryptography uses separate keys for encryption and decryption. The public key can be shared; the private key must stay secret. SSH key authentication and digital signatures are examples. Elliptic-curve cryptography underpins many implementations.
Where is this used in blockchain? Wallets and transfers. Wallets store your private key; your balance is computed from UTXOs (Unspent Transaction Outputs). You collect UTXOs to see how much you own.
Transactions and miners
- Transactions are the atomic units that record sending currency or claiming block rewards. Like DB transactions, they keep data consistent.
- Miners use massive compute resources to solve the puzzles defined by the consensus algorithm and package transactions into blocks. They earn coins as a fee for doing so.
Bitcoin, for example, asks miners to find a double-hashed value below a target. Because hashes are one-way, the only strategy is brute force, which is why it consumes so much compute power.
Each transaction output (UTXO) can become the input of the next transaction. When you get change during a payment, the input references your previous outputs and the change becomes part of the new outputs. Because everything is modeled as input/output pairs, you never end up in a state where one side updates without the other.
Consensus algorithms
The trickiest pillar is consensus. Wikipedia defines it as a protocol that lets distributed nodes agree on a single value/state. In short, it is the rulebook for forming consensus. Bitcoin uses PoW (Proof of Work); Ethereum currently uses PoS (Proof of Stake).
Proof of Work (PoW)
Literally “proof of work.” Miners include transactions in blocks by solving the PoW puzzle. The computed value (called the nonce) must satisfy the difficulty target. Neighboring nodes verify the result and propagate it outward. Once the network agrees it is correct, the block is accepted. This is how Bitcoin forms consensus.
Proof of Stake (PoS)
PoS shifts from “whoever has more compute wins” to “whoever stakes more coins earns the right to validate.” Validators lock coins, propose blocks, and are rewarded (or slashed) based on behavior. Energy consumption is far lower and the system is less prone to 51% attacks.
Many other consensus algorithms exist (DPoS, PBFT, etc.), and each blockchain picks one that fits its goals.
Languages, libraries, and tools
Because Ethereum popularized smart contracts, most docs are in English. Useful resources include:
- Solidity (smart contract language)
- Web3.js / web3.py
- Truffle, Remix, Hardhat
- Go-Ethereum (geth)
- Bitcoin Core
To run a private net, you typically spin up geth (Go) or parity (Rust). For smart contract dev you will write Solidity, test with JavaScript/Python harnesses, and deploy via CLI tools.
Closing thoughts
Japanese information on blockchain is still scarce, so you often have to read papers, wikis, or talks in English (e.g., Bettina Warburg’s TED talk or Satoshi Nakamoto’s original paper). Still, the technology has plenty of potential beyond cryptocurrencies. I hope more people take interest—it will accelerate progress.
References
- All links mentioned in the text
- 堅牢なスマートコントラクト開発のためのブロックチェーン技術入門 (Gijutsu-Hyoronsha)
- ブロックチェーンアプリケーション開発の教科書 (Mynavi)