Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about bitcore-p2p #99

Open
afterburn opened this issue Dec 4, 2017 · 0 comments
Open

Questions about bitcore-p2p #99

afterburn opened this issue Dec 4, 2017 · 0 comments

Comments

@afterburn
Copy link

afterburn commented Dec 4, 2017

I'm trying to find a P2P library that allows me to easily do peer discovery without having to worry about things like NAT traversal. I've recently started developing an interest for blockchain technology so I need this P2P network to test my own blockchain implementation on. I'm relatively new to networking so things like NAT traversal are mechanisms I'd prefer not to put a lot of effort into, so I was hoping bitcore-p2p could provide the functionality I need.

Basically I need functionality like this:

// Create a node on the users' local machine.
const socket = new Peer("127.0.0.1", 3000);

// Listen for events.

// emitted when peer connects to this node.
socket.on('peer_connected', (peer) => {
    // send data to this peer.
    peer.write('some data');
    
    //relay the peer_connected events to other peers.
    socket.peers.emit('peer_connected', peer);
});

// emitted when peer disconnects from this node.
socket.on('peer_disconnected', (peer) => {
    //relay the peer_disconnected events to other peers.
    socket.peers.emit('peer_disconnected', peer);
});

// emitted when data is received from another peer.
socket.on('data', (data, peer) => {

});

I was wondering if bitcore-p2p is solely usable for the bitcoin network or is it possible to create my own network as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant