Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

thachhoang/cbitcoin417

Repository files navigation

Authors: Andrew Badger, Thach Hoang

Ideas

Done:

  • Use poll() in a loop to monitor everything
  • Peer objects are collected in CBAssociativeArray
  • At the start, actively connect to initial peers (kale.cs.umd.edu)
  • Accept incoming connections, create new sockets and save new peers in corresponding peer objects
  • Version exchange
  • Ping/pong timer (60 seconds)

Pending:

  • Send a get-address message to each peer (once), then try to connect to the results

References

Notes

Variable length integer

Source

Look at the first byte.

If that first byte is less than 253, use the byte literally.

If that first byte is 253, read the next two bytes as a little endian 16-bit number (total bytes read = 3).

If that first byte is 254, read the next four bytes as a little endian 32-bit number (total bytes read = 5).

If that first byte is 255, read the next eight bytes as a little endian 64-bit number (total bytes read = 9).

Setup

Install libraries:

sudo apt-get install libssl-dev
sudo apt-get install libev-dev

Add this line to .bashrc (use absolute path to /bitcoin417/bin):

export LD_LIBRARY_PATH=~/Documents/project/bitcoin417/bin:$LD_LIBRARY_PATH

Finally in /bitcoin417:

./configure; make clean; make examples-build