Git Product home page Git Product logo

btcd-node-handshake's Introduction

btcd-node-handshake

This project implements a btcd node handshake in Golang. It allows you to establish a network handshake with a btcd node.

Installation

To build the project, simply run the following command:

$ make build

This will compile the project and generate an executable file.

Usage

Before launching the project, you need to create a configuration file named config.yml. You can find a sample configuration file inside the config folder. Copy this sample configuration file and customize it according to your requirements.

To launch the project, run the generated executable and pass the path to your configuration file using the config argument:

$ ./btcd-node-handshake --config=config/config.yml

Replace config/config.yml with the path to your actual configuration file.

Configuration

The configuration file config.yml allows you to specify various settings for the btcd node handshake, including network parameters, server settings, and logging options. Make sure to customize the configuration file according to your needs.

Testing

To test the handshake with a btcd node locally, you need to launch a btcd node with debugging enabled (please follow the related installation instructions). Run the following command:

$ btcd --debuglevel=debug

After launching the btcd node, launch the btcd-node-handshake program as described above. Upon successful handshake completion, you should see a bunch of logs in the btcd-node-handshake detailing the exchanged comm messages and a "Handshake completed" log eventually.

In the btcd node instead, you should read logs as described below:

2024-04-15 20:12:44.425 [DBG] PEER: Received version (agent /btcwire:0.5.0/, pver 70016, block 212672) from 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.425 [DBG] PEER: Negotiated protocol version 70016 for peer 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.425 [DBG] CHAN: Added time sample of 0s (total: 7)
2024-04-15 20:12:44.425 [DBG] CHAN: New time offset: 0s
2024-04-15 20:12:44.425 [DBG] PEER: Sending version (agent /btcwire:0.5.0/btcd:0.24.2/, pver 70016, block 11111) to 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.426 [DBG] PEER: Sending sendaddrv2 to 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.426 [DBG] PEER: Sending verack to 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.426 [DBG] PEER: Received verack from 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.426 [DBG] PEER: Connected to 127.0.0.1:64590
2024-04-15 20:12:44.426 [DBG] SRVR: New peer 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.426 [INF] SYNC: New valid peer 127.0.0.1:64590 (inbound) (/btcwire:0.5.0/)

which means that the btcd node has accepted the handshake program as a new peer, and it's ready for post-handshake communication (out of scope of this implementation). You should also read these logs:

2024-04-15 20:12:44.426 [INF] SYNC: Lost peer 127.0.0.1:64590 (inbound)
2024-04-15 20:12:44.426 [DBG] SRVR: Removed peer 127.0.0.1:64590 (inbound)

because the btcd-node-handshake does not keep the connection alive.

Dependencies

This project relies on the following dependencies:

These dependencies will be automatically downloaded and managed using Go modules.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

btcd-node-handshake's People

Contributors

robcanini avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.