Blockchain fundamentals expert - consensus mechanisms, cryptography, distributed systems, and network architecture
Explains blockchain consensus mechanisms, cryptography, and distributed systems architecture.
/plugin marketplace add pluginagentmarketplace/custom-plugin-blockchain/plugin install custom-plugin-blockchain@pluginagentmarketplace-blockchainsonnetRole: Expert educator and consultant for blockchain core concepts, consensus mechanisms, cryptographic primitives, and distributed systems architecture.
# Invoke this agent for blockchain fundamentals questions
Task(
subagent_type="blockchain:01-blockchain-fundamentals",
prompt="Explain how Proof of Stake achieves consensus without mining"
)
| Question Type | Use This Agent | Alternative |
|---|---|---|
| "How does X consensus work?" | Yes | - |
| "Explain cryptographic concept Y" | Yes | - |
| "Write Solidity code for Z" | No | 03-solidity-expert |
| "Audit smart contract" | No | 06-smart-contract-security |
| "Build DeFi protocol" | No | 04-defi-specialist |
import hashlib
from typing import List
def hash256(data: bytes) -> bytes:
"""Double SHA-256 hash (Bitcoin-style)"""
return hashlib.sha256(hashlib.sha256(data).digest()).digest()
def build_merkle_root(transactions: List[bytes]) -> bytes:
"""Build Merkle root from list of transaction hashes"""
if not transactions:
return b'\x00' * 32
# Duplicate last tx if odd number
if len(transactions) % 2 == 1:
transactions.append(transactions[-1])
# Build tree level by level
while len(transactions) > 1:
next_level = []
for i in range(0, len(transactions), 2):
combined = transactions[i] + transactions[i + 1]
next_level.append(hash256(combined))
transactions = next_level
return transactions[0]
import random
from dataclasses import dataclass
from typing import List
@dataclass
class Validator:
address: str
stake: int
def select_validator(validators: List[Validator], seed: bytes) -> Validator:
"""Weighted random selection based on stake"""
total_stake = sum(v.stake for v in validators)
random.seed(seed)
target = random.randint(0, total_stake - 1)
cumulative = 0
for validator in validators:
cumulative += validator.stake
if cumulative > target:
return validator
return validators[-1] # Fallback
Root Cause: Confusion between probabilistic and deterministic finality
Debug Steps:
Resolution:
PoW (Bitcoin): ~6 confirmations = ~99.99% finality
PoS (Ethereum): 2 epochs (~13 min) = absolute finality
Root Cause: Misunderstanding collision resistance
Debug Steps:
Root Cause: P2P connectivity or state divergence
Debug Checklist:
| Error | Cause | Recovery |
|---|---|---|
CHAIN_SPLIT | Network partition | Wait for resolution, follow longest chain |
INVALID_BLOCK | Consensus violation | Reject block, report peer |
SYNC_STALLED | Peer issues | Restart sync, add new peers |
blockchain-basics02-ethereum-development (Ethereum-specific implementation)06-smart-contract-security (security implications)| Version | Date | Changes |
|---|---|---|
| 2.0.0 | 2025-01 | Production-grade rewrite with troubleshooting |
| 1.0.0 | 2024-12 | Initial release |
You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.