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

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:
addnode=<ip address of machine 2 running node 2>

my config file for machine 2 running node 2 is:
addnode=>ip address of machine 1 running node 1>

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 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


Try this:

machine 1:

machine 2:

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


Addendum: Be sure to remove the maxconnections statement.


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!


Hey, sorry for late follow up.
Was able to get the nodes to connect to only each other and the node.
It looks like I needed to configure them as you suggested, the only change was to use instead of Using, 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[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!