# Connecting to specific nodes using addnode \[university crypto class project\]

**URL:** <https://forum.zcashcommunity.com/t/connecting-to-specific-nodes-using-addnode-university-crypto-class-project/35514>\
**Category:** Technical Support\
**Created:** [November 27, 2019, 8:34pm UTC](https://forum.zcashcommunity.com/t/connecting-to-specific-nodes-using-addnode-university-crypto-class-project/35514 "2019-11-27T20:34:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![padawan](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@padawan](https://forum.zcashcommunity.com/u/padawan)\
**Post date:** [November 27, 2019, 8:34pm UTC](https://forum.zcashcommunity.com/t/connecting-to-specific-nodes-using-addnode-university-crypto-class-project/35514/1 "2019-11-27T20:34:00Z")

</div>

Hello, sorry i’m very new to blockchain and zcash.

I’m an undergrad in a crypto class and my term project is on the security of zcash using ak-SNARKS. For my project I’m trying to replicate the PING attack described on the recent Standford publication.

I was a bit confused on how to ping a specific node, but I understand using the zcash-cli ping and zcash-cli getpeerinfo I can get the ping response time, which is what I need. But i’m having trouble adding specific nodes to my nodes peer’s list.

I have two machines set up running zcashd. I’m trying to make it so that the machines are connected to each other and the testnest. One node uses the outdated version v.2.0.7 that has the PING attack vulnerability and one node uses the latest V2.1.0-1

my config file for machine 1 running node 1 is:  
testnet=1  
addnode=testnet.z.cash  
addnode=\<ip address of machine 2 running node 2\>  
maxconnections=2

my config file for machine 2 running node 2 is:  
testnet=1  
addnode=testnet.z.cash  
addnode=\>ip address of machine 1 running node 1\>  
maxconnections=2

I’ve also tried using the connect= flag and a maxconnection=1, but then both nodes don’t make any connections, as if the ip address of both nodes are unreachable. (I’ve ping each ip address on both machines so they are reachable).

But when I start the zcashd on each machine neither of the two nodes are in the getpeerinfo list or JSON objects.

Both only have two connections, both have one connection to the testnet.z.cash ip address, but the second one is to some other node (both different).

I followed the download from source instructions on the website and launched them after following them that way. I haven’t enabled mining or created addresses for either one. Both are on a LAN and both are on my universities network.

If anyone has any advice on how I could recreate this attack, or get specific nodes on a getpeerinfo, or if you think I’m deeply misunderstanding something, any pointers in the right direction would be appreciated!

Thank you

---

<div class="post-metadata">

**Author:** ![hloo](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/hloo/32/4096_2.png) [@hloo](https://forum.zcashcommunity.com/u/hloo)\
**Post date:** [November 27, 2019, 10:39pm UTC](https://forum.zcashcommunity.com/t/connecting-to-specific-nodes-using-addnode-university-crypto-class-project/35514/2 "2019-11-27T22:39:18Z")

</div>

Try this:

machine 1:

connect=testnet.z.cash  
connect=ip\_address\_of\_machine\_2

machine 2:

connect=testnet.z.cash  
connect=ip\_address\_of\_machine\_1

With this, I believe that each machine will respectively have the exact two connections that you want, and no other connections.

---

<div class="post-metadata">

**Author:** ![hloo](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/hloo/32/4096_2.png) [@hloo](https://forum.zcashcommunity.com/u/hloo)\
**Post date:** [November 27, 2019, 11:26pm UTC](https://forum.zcashcommunity.com/t/connecting-to-specific-nodes-using-addnode-university-crypto-class-project/35514/3 "2019-11-27T23:26:48Z")

</div>

Addendum: Be sure to remove the maxconnections statement.

---

<div class="post-metadata">

**Author:** ![padawan](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@padawan](https://forum.zcashcommunity.com/u/padawan)\
**Post date:** [November 27, 2019, 11:48pm UTC](https://forum.zcashcommunity.com/t/connecting-to-specific-nodes-using-addnode-university-crypto-class-project/35514/4 "2019-11-27T23:48:31Z")

</div>

Thank you so much, I’ll have to wait to try it out tomorrow in the lab as I don’t have after hours access, I’ll give some updates!

---

<div class="post-metadata">

**Author:** ![padawan](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@padawan](https://forum.zcashcommunity.com/u/padawan)\
**Post date:** [December 2, 2019, 2:47am UTC](https://forum.zcashcommunity.com/t/connecting-to-specific-nodes-using-addnode-university-crypto-class-project/35514/5 "2019-12-02T02:47:36Z")

</div>

Hey, sorry for late follow up.  
Was able to get the nodes to connect to only each other and the testnet.z.cash node.  
It looks like I needed to configure them as you suggested, the only change was to use addnode=testnet.z.cash instead of connect=testnet.z.cash. Using connect=testnet.z.cash, my zcash client was only running on port localhost:[port] and remote processes saw the [port] as cloded. Using addnode instead allowed it to run on 0.0.0.0:[port] and the port was open.  
I’m finding that using addnode in this way doesn’t allow the node to connect to nodes not specified in the cofig file, which is a bit counter to my expectations from reading the docs about addnode.  
But all is good what my needs now thank you!
