Skip to content

Instantly share code, notes, and snippets.

View rustaceanrob's full-sized avatar
💥

Robert Netzke rustaceanrob

💥
View GitHub Profile
use std::{io::BufReader, net::{IpAddr, Ipv4Addr, SocketAddr, ToSocketAddrs}, time::{SystemTime, UNIX_EPOCH}};
use bip324::{Handshake, Role};
use bitcoin::{consensus::{deserialize, serialize, Encodable}, p2p::{message::{NetworkMessage, RawNetworkMessage}, message_network::VersionMessage, Address, ServiceFlags}, Network};
use bytes::BytesMut;
use tokio::{io::{AsyncReadExt, AsyncWriteExt}, net::TcpStream};
pub const PROTOCOL_VERSION: u32 = 70015;
pub fn new_version_message() -> Vec<u8> {
  • Epoch is $k$ blocks (e.g. $k = 10,000$)
  • $s$ are the droplets encoded per epoch
  • Storage reduction factor is $\frac{1}{(k/s)}$ and needs approximately $k/s$ honest nodes

LT coding (clear droplets)

  • Sample a degree $d$ from ${1,..,k}$
  • Sample $d$ blocks from $k$ uniformly at random
  • Bitwise XOR the $d$ blocks
  • Encode a droplet $C_{j} = B_{1} \oplus .. \oplus B{j}$

Adversarial behavior

  • Merky droplet: Peer reports $C_{a} \neq v_{a}B$