The CargoSOS Bitcoin Node Wallet is a Rust-written node wallet for the bitcoin testnet peer to peer network. It includes a TUI (terminal user interface) and a GUI (graphical user interface) implemented using the GTK-3 library.
It was developed following the bitcoin developer guides and the bitcoin reference guides.
Our programs capabilities are as follows:
- Node
- Connecting to other peers in the bitcoin network through a TCP connection following the protocol. To achieve this we make use of multiple threads to manage each connection.
- Being able to receive and send the different messages described in the protocol.
- Downloading and storing the complete blockchain, storing all the block headers that have ever existed, and all the transactions starting from a date expressed in Unix Epoch Time in the configuration file.
- Being able to serialize the blockchaing into a file for persistency and reading it upon the programs start.
- Upon the programs start, updating the blockchain with the new blocks using a headers-first approach.
- When the program is active, it updates the internal data as it receives messages from other peers, including new blocks and transactions.
- When receiving Block information from other peers, executes a Proof of Work to validate it, and a Proof of Inclusion when receiving its transactions, by creating a Merkle Tree.
- Keeps a record of all the UTXO (unspent transactions) for easier calculation of balance.
- The node can be run as a Server, listening to a port we can specify in the configuration file for incoming connections, while at the same time connecting with other peers.
- The node can be run as a client, trying to connect to a single specific port and IP address to make it its peer.
- Wallet
- Our program can store bitcoin addresses that the user provides by specifying the public and private keys.
- Our program can calculate the current balance of a given address by adding up the UTXO corresponding to it.
- Every time we receive an unconfirmed transaction from a peer that involves one of the addreses currently stored in the wallet, it is notified.
- Every time we receive a new block sotring a transaction that involves one of the addreses currently stored in the wallet, it is notified.
- The user can generate transactions by providing the necessary information about the recipient. The supported protocol is P2PKH.
- Given a transaction and a block, a user can do a Merkle Proof of Inlcusion to know if a transaction is part of a block.
- The bitcoin addresses are stored in a file for persistency and read when the program starts again.
- Configuration
- The program accepts a configuration file where we can specify various parameters and preferences about the program being run, like:
- P2P protocol version.
- Initial block download method (only supports Headers First)
- The amount of peers we would like to connect to and where to look for them.
- The port and address the node can run on as a server.
- Wheter or not we would like the logs to be printed to the console
- The paths to the places we would like to read or write persistency files.
- The timestamp in Unix Epoch Time from which the full blocks on the blockchained are going to be downloaded.
- The type of interface we would like to use (GUI or TUI).
- The program accepts a configuration file where we can specify various parameters and preferences about the program being run, like:
- Logs
- The program has a log system that will store information about the things happening during the execution.
The programs Graphical User Interface was developed with the GTK-3 library in rust.
In addition to the GUI, we also implemented a TUI to be able to use the program with the command line. It has a menu and depending on what you choose, it will ask for specific information or display the information requested.
To execute the proyect, the following command has to be used
cargo run --bin bitcoin path/to/node.conf
cargo run --bin bitcoin src/bin/bitcoin/node_server.conf
cargo run --bin bitcoin src/bin/bitcoin/node_client.conf
Since this program was developed by us during a university course, we did three presentations showcasing the structure and evolution of our program.
The presentation can be found at: https://docs.google.com/presentation/
The presentation can be found at: https://docs.google.com/presentation/
The presentation can be found at: https://docs.google.com/presentation/