-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
chat with rendezvous #2880
Comments
Hi, prvKey, _, err := crypto.GenerateKeyPairWithReader(crypto.RSA, 2048, rand.Reader)
if err != nil {
log.Println(err)
return
}
relay1, err := libp2p.New(libp2p.Identity(prvKey), libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/9876", "/ip4/0.0.0.0/udp/9876/quic-v1"))
if err != nil {
log.Printf("Failed to create relay1: %v", err)
return
}
_, err = relay.New(relay1)
if err != nil {
log.Printf("Failed to instantiate the relay: %v", err)
return
}
_, err = dht.New(context.Background(), relay1, dht.Mode(dht.ModeServer)) //
if err != nil {
log.Printf("Failed to create DHT: %v", err)
return
}
fmt.Printf("[*] Your Bootstrap ID Is: /ip4/%s/tcp/%v/p2p/%s\n", "0.0.0.0", 9876, relay1.ID().String()) You can specify the bootstrap node by specifying the |
@iGwkang thanks buddy, I am trying to build a blockchain, therefore each node should be behaving same, when someone wants to join the p2p network, I want each of the nodes to act as a bootstrap node, is this possible with this example and your solution after initial start of the network, and some number of peers are active? |
Nice idea You don't have to be all nodes as bootstrap nodes, it does not make any sense. every node is already storing local dht table, so it won't be an issue Bootstrup nodes however, in a contradiction to miner's nodes, should have a public dedicated IP and it's cannot be under NAT. This thing is also should be always up. If you are familiar with torrent, then think about bootstrap nodes as a torrent tracker, and if you are familiar with ethereum v.2, then think of it as a Beacon nodes. Other (miners) nodes in your network can be behind the NAT and also it can go offline very often, so you just can't use it as bootstrap nodes Also tell me more about your blockchain project? |
Oh, thanks, so default IPFS bootstrap nodes doesn't work anymore, cause of too many connections and now we have to run bootstrap nodes for ourselves? |
thanks a lot, I already solved my problem and created a simple p2p network by tinkering the docs and examples! |
hi, im trying to build a toy blockchain to learn fundamentals. I want to use libp2p for communicating nodes. (I tried couple of things, correct me if I tell anything wrong below)
I tried
pub/sub
example, but that was communicating over a relay node, peers doesn't directly communicating each other but messages coming from a single bootstrapper node.Then I tried
chat with mdns
example, I could do the things I want to do using it, but then I realized I cannot use that globally, its only for LAN network.Then I switched to
chat with rendezvous
example, it seems like it can solve my problem, but I cannot run the nodes, im getting the following error, immediately after starting the first node.My question is, for my case, which examples should I rely on for communicating the nodes in my blockchain? And if its the
chat with rendezvous
example, how I can fix the error below :Dthanks in advance
The text was updated successfully, but these errors were encountered: