8 minute read

UCL Course COMP0143 Cryptocurrencies: LEC-01


Network Architecture

Classic Client-Server Paradigm

  • Server

    • Provide resources and services (reply)

    • Passive (only reply when client requests)

  • Client

    • Request resources and services (only request, not share)

    • Active (should have the knowledge about sever)

Peer-to-Peer (P2P) Paradigm

  • All actors, called peers, are equal

  • Can have both server and client capabilities (chosen by themselves)

  • Resources and services are shared between peers

Roles Specific in Bitcoin

Regular

  • Create transactions to spend bitcoins

  • Verify the correctness of received transactions and blocks

  • Reply valid transactions and blocks

Miner

  • Create, Verify, and Reply

  • Mine blocks by solving puzzles and win rewards

Network Taxonomy

  • Reachable Network: accept public incoming connections

  • Non-reachable Network: not accept or cannot be reached (hidden behind NAT or blocked by firewall)

  • Extend Network: use different protocols to communicate (not always P2P)


Address Propagation

Challenges

  • How do new peers find existing ones in the network? (Are found nodes trusted?)

  • How do new peers announce their presence in the network?

Peer Bootstrapping Approaches

  • Internet Relay Chats (IRC) - Deprecated 不赞成的

    Use IRC channels on irc.lfnet.org to bootstrap (bundled with a small IRC client)

    Join a random channel between bitcoin00 and bitcoin99, then connect to other peers (until its peer database full)

    Abandoned after irc.lfnet.org was shutdown

  • Trusted DNS Seed Servers

    DNS - Domain Name System: Map URLs to IP addresses

    To obtain a list of active peers,

    the new nodes can first quires serveral well-known DNS Seed Servers

    Command to query in Unix

      dig [DNS URLs]
    
  • Hardcoded Trusted Addresses

    If DNS does not work or you do not trust the listed peers,
    the new nodes can connect to a hardcoded list of seed servers (as a last resort)

Populate in Peer Database

  1. New node \(P\) obtains a list of peers using previous appraoches

  2. \(P\) establishes some outgoing connections to a subset of these peers (by default 8)

  3. \(P\) tries to maintain these connections

  4. \(P\) requests more peers from those neighbours

  5. These peers reply with address that they know about in their peer databases (up to 1000 addresses)

  6. \(P\) adds these given address into its peer database or update existing entries

  7. Every node will also accepting incoming connections to serve other peers (by default 117)

Address Propagation Approach (Announce)

To propagate the address of new node \(P\)

  1. The connected points \(A\) picks a random subset of its neighours to relay \(P\)’s address

  2. All nodes receiving \(P\)’s address from \(A\) will do the same behaviour as \(A\)

  3. \(P\)’s address will spread to the whole network (each nodes has the address in its peer database)


Information Propagation

Challenges

  1. How do you find what information other peers are sharing? (Who? Knows what?)

  2. How are files served? (since files may be held by serveral users in distributed systems)

Information Propagation Approaches (Gossip)

Request (Traditionally but Rarely Used in Cryptocurrency Network)

Network needs a lookup protocol to identify via Distributed Hash Tables (DHTs) or trackers

  1. One Node \(P\) requests file information from a tracker \(T\)

  2. \(P\) retrieves peer list in the .torrent files given by \(T\)

  3. \(P\) connects to these peers, and then retrieve file parts

Cons: Some kind of centralization for lookup protocol

Announce (Commonly Follow in Cryptocurrency Network)

FIles are announced to peers (decide whether they would like a copy or not)

No lookup protocol required

1. Announce

  • When receiving or generating a new artifact \(H(tx_i)\)

    announcer will communicate an identifer to their neighbours via an inventory message

2. Request

  • When receiving the announcement of a new identifier,

    Peers who do not know the artifact will request it from the announcer

3. Dliver

  • When receiving the request of a known artifact,

    announcer will transmite the artifact to the requester

The announce approach usually refer as Gossip Protocol

Propagation Rules

  • Unknown trasactions/blocks are accepted

  • Known trasactions/blocks are rejected (do not care known ones)

  • Accepted trasactions/blocks are validated

  • Invalid trasactions/blocks are rejected

  • Vaid trasactions/blocks are stored in memory

Features

  • No lookup protocol, No central entity

  • It will take longer time for an artifact spread to the entire network when the network is bigger

  • Longer propagation time for blocks will cause bigger possibilities for blockchain forks

Q&A

1. How can blocks propagte faster than transactions? (size: block » transaction)

  • Transactions are accumlated in buffer and forwarded in batches

    to break the link between first relayer and the origin of the transaction

  • The propagation of blocks is not delayed to reach full network coverage as quickly as possible

2. How can blocks propagated so fast? (size: block » transaction)

  • There exist some fast relay networks (Falcon, FIBRE …)

    on top of Bitcoin to enhance block propgation times

  • Miners use these networks to ensure minial propagation times

    always mine on top of the most recent block


Network-Based Attacks

Denial-of-Service (DoS)

Aim

Make a machine or network resource unavailable to its intended users
by temporarily or indefinitely disrupting services of Internet-connected host

Attacks in Bitcoin

Based on one mechanism Bansore Reputation System

  • Each nodes maintain a bansore for each neighbours

  • When detecting misbehaviours of one peer, its corresponding banscore will be increased

    Misbehaviours have different levels which lead to different banscore increased

  • When banscore reaches a threshold (100 by default)

    communication between them will be banned (for 24 hours by default)

Penny Flood: a large amount of small but possible transactions (each requries output)

Stress Test: the memory pool is overwhelmed (to test whether a bigger block is need or not)

Surveillance

Aim

Identities are not strictly tied to IP address via pseudonyms

Hence, surveillance is aimed to identify IP address of a transaction originator (privacy at risk)

Approach

Set up a supernode that can connect to all known peers (not difficult by mapping)
based on messages in gossip network are broadcasted publicly as quickly as possible

Protection

Diffusion: Each node forwards a new transaction only after a randomly set delay (not improve)

Dandelion: Use special transaction dissemination patterns (performance trade-off)

Eclipse Attacks

Aim

Partition the network by controlling the network view of another node

such that attackers can do double-spending or delay block delivery

Protection

Use relay-network (i.e. SABRE - against Partition and DDoS)

Front-running Attacks

Background: Memory Pool & Unconfirmed Transactions

Definition: The memory pool which is a list of valid but unconfirmed transactions

Insert: Transactions are copied into the memory pool if they are valid

Delete: When receiving a valid block, all included transactions in this block will be deleted from the mining pool

Miners use these transactions to form blocks for mining

A block and its payload are confirmed if enough blocks have been mined on top of it
because the chance of a fork happens there has become negligible

Dangers of Partically Confirmed Blocks

Blocks should be dropped if they end up on an orphaned fork

Therefore, nodes that accept these partically confirmed blocks
might become targets of double-spending attacks

Dangers of Unconfirmed Transactions

Unconfirmed transactions have not even been mined and are much cheaper to create
which can lead to many security issues (e.g., double-spending attacks, front-running attacks …)

Approach & Aim

Attackers exploit the fact that they can see unconfirmed transactions before they are included in the blockchain
such that attackers can manage to get their own transaction processed first (e.g., by offering a higher gas price)

To modify the outcome of a transaction, steal rewards, and even to influence consensus

Current Situations

Lots of related researches are active