Cryptocurrency
Bitcoin, Ethereum, transaction mechanics, wallets, and digital signatures.
Overview
Cryptocurrency is digital currency secured by cryptography.
Bitcoin Transaction
{
"txid": "abc123...",
"inputs": [
{
"prevTx": "def456...",
"outputIndex": 0,
"scriptSig": "signature..."
}
],
"outputs": [
{
"value": 0.5,
"scriptPubKey": "address..."
}
]
}
Wallet Types
| Type | Security | Convenience |
|---|---|---|
| Hardware | High | Low |
| Software | Medium | High |
| Paper | High | Low |
| Web | Low | High |
Ethereum Accounts
// EOA (Externally Owned Account)
const account = {
address: "0x1234...",
balance: "1.5", // ETH
nonce: 42,
privateKey: "0x..."
};
// Contract Account
const contract = {
address: "0x5678...",
balance: "10.0",
code: "0x606060...",
storage: {}
};
Gas Fees
// Gas calculation
const gasLimit = 21000;
const gasPrice = "20"; // Gwei
const totalFee = gasLimit * gasPrice;
// Total in ETH = totalFee * 10^-18
Mining Rewards
Architecture Diagram
Bitcoin Halving Schedule:
2009: 50 BTC
2012: 25 BTC
2016: 12.5 BTC
2020: 6.25 BTC
2024: 3.125 BTC
Practice
Create a simple cryptocurrency wallet application.