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

net: add I2P hardcoded seeds #21825

Merged
merged 3 commits into from May 4, 2021
Merged

Conversation

jonatack
Copy link
Contributor

@jonatack jonatack commented May 1, 2021

Follow-up to #21560 that updated the fixed seeds infra for BIP155 addresses and then added Tor v3 ones:

  • Update contrib/generate-seeds.py to parse I2P addresses

  • Add a few I2P nodes to contrib/seeds/nodes_main.txt

  • Run generate-seeds.py and add the I2P seeds to chainparamsseeds.h

Reviewers, see contrib/seeds/README.md for more info and feel free to use the following CLI one-liner to check for and propose additional seeds for contrib/seeds/nodes_main.txt. You can also see how many I2P peers your node knows with cli -addrinfo.

bitcoin-cli getnodeaddresses 0 | jq '.[] | (select(.address | contains(".b32.i2p"))) | .address' | sort

I verified the I2P addresses are correctly BIP155-serialized/deserialized by building with all seeds removed from chainparamsseeds.h except those added here, restarting with -datadir=newdir -dnsseed=0 and running rpc getnodeaddresses 0 that initially returns only the new I2P addresses.

@jonatack
Copy link
Contributor Author

jonatack commented May 2, 2021

Screenshot from 2021-05-02 15-45-20

Tested several times running a node with no peers.dat, dnsseed=0, noonion, onlynet=i2p, and only these new I2P seeds in chainparamsseeds, and it connects to all of the I2P seeds that are online right now.

-addrinfo and getnodeaddresses

$ bitcoin-cli -addrinfo
{
  "addresses_known": {
    "ipv4": 0,
    "ipv6": 0,
    "torv2": 0,
    "torv3": 0,
    "i2p": 8,
    "total": 8
  }
}

$ bitcoin-cli getnodeaddresses 0
[
  {
    "time": 1619267336,
    "services": 9,
    "address": "wwbw7nqr3ahkqv62cuqfwgtneekvvpnuc4i4f6yo7tpoqjswvcwa.b32.i2p",
    "port": 8333,
    "network": "i2p"
  },
  {
    "time": 1619331060,
    "services": 9,
    "address": "hnbbyjpxx54623l555sta7pocy3se4sdgmuebi5k6reesz5rjp6q.b32.i2p",
    "port": 8333,
    "network": "i2p"
  },
  {
    "time": 1618857028,
    "services": 9,
    "address": "72l3ucjkuscrbiiepoehuwqgknyzgo7zuix5ty4puwrkyhtmnsga.b32.i2p",
    "port": 8333,
    "network": "i2p"
  },
  {
    "time": 1619232946,
    "services": 9,
    "address": "zsxwyo6qcn3chqzwxnseusqgsnuw3maqnztkiypyfxtya4snkoka.b32.i2p",
    "port": 8333,
    "network": "i2p"
  },
  {
    "time": 1619240850,
    "services": 9,
    "address": "pjs7or2ctvteeo5tu4bwyrtydeuhqhvdprtujn4daxr75jpebjxa.b32.i2p",
    "port": 8333,
    "network": "i2p"
  },
  {
    "time": 1618776457,
    "services": 9,
    "address": "c4gfnttsuwqomiygupdqqqyy5y5emnk5c73hrfvatri67prd7vyq.b32.i2p",
    "port": 8333,
    "network": "i2p"
  },
  {
    "time": 1619959105,
    "services": 1033,
    "address": "h3r6bkn46qxftwja53pxiykntegfyfjqtnzbm6iv6r5mungmqgmq.b32.i2p",
    "port": 8333,
    "network": "i2p"
  },
  {
    "time": 1619108616,
    "services": 9,
    "address": "gehtac45oaghz54ypyopim64mql7oad2bqclla74l6tfeolzmodq.b32.i2p",
    "port": 8333,
    "network": "i2p"
  }
]

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 142e2da

I verified that the additions to src/chainparamsseeds.h are generated from the extended contrib/seeds/nodes_main.txt. The I2P peers in my node's list of peers are a subset of the added ones.

The command from the PR description did not work for me because the getnodeaddresses RPC does not return a JSON with network field. I used this instead:

bitcoin-cli getnodeaddresses 0 |jq -r '.[] | (select(.address |test("\\.i2p$"; "i"))) | .address' | sort

@Emzy
Copy link
Contributor

Emzy commented May 3, 2021

ACK
I'm one of the I2P seeds.

@jonatack
Copy link
Contributor Author

jonatack commented May 3, 2021

The command from the PR description did not work for me because the getnodeaddresses RPC does not return a JSON with network field.

Indeed, it was added only very recently to master in #21594 (thanks!) Updated the PR description to work before that merge.

@jonatack
Copy link
Contributor Author

jonatack commented May 3, 2021

Collecting ways to do this with jq 😎

./src/bitcoin-cli getnodeaddresses 0 | jq '.[] | (select(.address | contains(".b32.i2p"))) | .address' | sort
./src/bitcoin-cli getnodeaddresses 0 | jq -r '.[] | (select(.address | test("\\.i2p$"; "i"))) | .address' | sort
./src/bitcoin-cli getnodeaddresses 0 | jq '.[] | (select(.network == "i2p")) | .address' | sort

@jonatack
Copy link
Contributor Author

jonatack commented May 3, 2021

Collecting ways to do this with jq sunglasses

or #21843...

@vasild
Copy link
Contributor

vasild commented May 3, 2021

... select(.address | contains(".i2p")) ...

I have xppyui2pgfuqegju.onion 🕳️

@laanwj
Copy link
Member

laanwj commented May 3, 2021

ACK 142e2da

  • Verified that python3 generate-seeds.py . > ../../src/chainparamsseeds.h gives the same output
  • Checked that all nodes (except one) are connectable
  • Checked getaddresses on my node, that all known I2Ps are covered here

@jonatack
Copy link
Contributor Author

jonatack commented May 3, 2021

* Checked that all nodes (except one) are connectable

Same, am connected to all but one. Pinged the person on IRC and they are checking.

@jonatack
Copy link
Contributor Author

jonatack commented May 3, 2021

Ok, that node is back online and expected to be stable. We're good 🚀

@laanwj laanwj merged commit ab9a566 into bitcoin:master May 4, 2021
@jonatack jonatack deleted the i2p-hardcoded-seeds branch May 4, 2021 08:27
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants