Walletwasabi: Zero peers in client

Created on 14 Apr 2019  路  16Comments  路  Source: zkSNACKs/WalletWasabi

General Description

The peer indicator on the right bottom corner is zero and it is stays like that. Even after one hour of waiting. With the release 1.1.3 everything is fine.

How To Reproduce?

  1. Checkout master.
  2. Open Visual Studio 2019.
  3. Run in debug.
  4. Zero peers.
  5. Load wallet.
  6. Still zero peers.

Screenshots

image

Operating System

Win10-x64

Logs

No relevant information.

Wasabi Version

https://github.com/zkSNACKs/WalletWasabi/commit/9332fe4bfac035fb03e7f9c37d05a46d05cfb6ba

debug priority

All 16 comments

We should catch the exception in NBitcoin and hack around. I have a feeling that this will be a localization issue, @NicolasDorier are you catching error messages here and there? Are you aware that Tor communicates with you on the language one's OS is set to?

This would be my first guess, but you should clone NBitcoin, add it to your Wasabi and debug into the code. Hopefully it's something stupid.

What I have tried:

  • Different networks and ISP providers.
  • My original Win10 install is Hungarian, switched to English.
  • Compile with Visual Studio 2017.
  • Deleted Addressmanager.dat.
  • If I turn off Tor usage it is working.

I think you can debug into NBitcoin, but I never tried: https://github.com/MetacoSA/NBitcoin#how-to-debug-in-nbitcoin-source-code

I implemented it back then, but that was only working with .NET Framework, not with Core, however Nicolas did something since that makes you able to debug into it with .NET Core.

Added NBitcoin.

At this line I continuously get the following error:
https://github.com/MetacoSA/NBitcoin/blob/bc9221047b0e6763d19ed2148c12176167466532/NBitcoin/Protocol/Connectors/DefaultEndpointConnector.cs#L41

System.InvalidOperationException: 'The Endpoint connector is configured to allow only Tor endpoints and the '[2a01:4f8:162:11e5::2]:8333' enpoint is not one'

The address changes every time.

image

@lontivero do you have any idea?

At this line:

https://github.com/zkSNACKs/WalletWasabi/blob/9332fe4bfac035fb03e7f9c37d05a46d05cfb6ba/WalletWasabi.Gui/Global.cs#L181

Addressmanages had 929 nodes.
Increased 500 to 5000. After half an hour the situation is still the same. Zero peers, AddressManager has 929 nodes.

@molnard just a comment to add some context here. AddressManager tries to find new peers all the time using a heavy CPU/Network process and for that reason I decided to limit it so, if we already know 500 peer nodes in the network then we don't try to search more.

IMO the problem is that Wasabi as it is now, can only connect to Tor addresses and you don't find any.
https://github.com/zkSNACKs/WalletWasabi/blob/master/WalletWasabi.Gui/Global.cs#L249

Update
The error that you see:

System.InvalidOperationException: 'The Endpoint connector is configured to allow only Tor endpoints and the '[2a01:4f8:162:11e5::2]:8333' enpoint is not one'

Is because the addresses that it tries to connect with are not Tor addresses (onioncat addresses). These addresses are easy to identify because the first few bytes are always the same (fd87d87eeb43) and the rest is the v2 onion domain name, that is the domain public key hash. In other words: they look like an ipv6 but they are not.

Update 2
If you want to discard/confirm the problem is with the discovery process I can give you my AddressManager file and then you can replace the yours one and try again.

@molnard what I commented above was correct but there was a more fundamental problem: Wasabi is trying to use Tor to connect only to bitcoin nodes published as hidden services. That's not what we want, we don't care whether a peer is accessible as a HS or not, we just want to connect to peers through Tor and that's it.

Let me fix this one please. I chatted with Nicolas Dorier and he is going to release a fix for NBitcoin, I am just waiting for it.

I was reviewing discovery process to understand better why this is happening. Lets start by saying that those users that have more than 500 addresses in their AddressManager.dat files but none of those are Tor addresses will not be able to connect to the p2p network (this is what happens to @molnard)

How it works

When we call Nodes.Connect, NBitcoin tries to discover peers (only if AddressManagerBehaviorMode.Discover is true) and after that it selects a address from the AddressManager and tries to connect to that.

First, here we have problem because we disable the discovery process if the AddressManager contains more than 500 addresses (even when it could has 0 Tor addresses). There are no way to get the full list of addresses in the AddressManager to query the number of Tor addresses.

Second, when the AddressManager detects it has 0 peer addresses it fetches new peers from the DNSs however, given it doesn't know anything about Tor a addresses, it doesn't uses the DNSs because it thinks there are available addresses.

Third, the discovery process continues by fetching list of addresses from the connected peers (only if AddressManagerBehaviorMode.Discover is true). However as I said before we disable the discovery process and there are no peers to fetch the addresses from.

Ideas

  • Clean the AddressManager after detecting 0 peers problem. In this way the AddressManager will query the DNSs and the discovery process will make sure to get the list of addresses from peers.
  • Provide a list of .onion domains in the config file (the user can add/modify/delete them) and add some of those to the AddressManager before calling the Nodes.Connect. In this way Wasabi will always be able to connect.

Note the previous ones and others don't solve the problem that AddressManager will continue selecting, recording and trying to connect to non-tor addresses.

  • Modify AddressManager in some way to:

    • to provide the full list of peers (then we can know whether there are tor addresses or not, and don't have to wait to know that it will be impossible to connect)

    • to accept a filter with the conditions to know if a address is valid or not. In our case we could say "work only with oniocat addresses".

    • to provide some way to use another fallback mechanism for getting a list of nodes.

    • etc.

What do you think about this @nopara73 @molnard @nicolasdorier?

Hmm. What if we store Tor compatible nodes in a different way (different file or add a boolean field) and count the limit separately. So when AddressManagerBehaviorMode.Discover == true then we will have a list of Tor and not Tor compatible nodes. Depending on the user selection in settings (Use Tor) Addressmanager will filter the list accordingly. When Addressmanager finds a peer is it possible to determine if is Tor compatible?

I like you idea Lucas. I think we should pre-load the address manager with onions, but we should also do some best-effort stuff like add a preferOnion option and so it'll always try to connect to onions first, but if it fails, it'll connect to non-onions. This could make it bulletproof.

@lontivero to be honest I don't like the way I handle the discovery process. I did not touched it because it is stable and works, but things I don't like are:

  1. It is not async
  2. It might do DNS requests without using the SOCKS proxy
  3. The problem of being full with clear peers, thus impossibility to have onion hosts

I am unsure of the best API for NBitcoin to fix those problems, but if you find better way I am open.

The seed list in bitcoin core has a bunch of Tor addresses though.

https://github.com/bitcoin/bitcoin/blob/8a9ffec0a257da659ba54c5073bfc820986ae9c1/src/chainparamsseeds.h#L1103 (what starts by { 0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43 })

I just updated the seeds, so you should find peers faster.

Also, this list has a bunch of Tor address as onioncat, so you can just use this. Just pushed a new version now.

4.1.2.6

I am trying to run wasabiwallet on parrot OS, there is an endless download to the wallet and nothing happens. Enabling / disabling the TOR connection in the wasabi settings does not change anything, the wallet does not load.
v1.1.3, network - main
peers:0

https://lutim.phyks.me/HTLu4NDQ/Z3z4wrE2.jpg
https://lutim.phyks.me/uEDv84MM/PjMPYFGI.jpg

@kolona5 Since the release a lot of things changed. You should try building from source: https://github.com/zkSNACKs/WalletWasabi/#build-from-source-code because it's likely it's been fixed since.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yahiheb picture yahiheb  路  3Comments

2pac1 picture 2pac1  路  3Comments

yahiheb picture yahiheb  路  3Comments

nopara73 picture nopara73  路  3Comments

davterra picture davterra  路  3Comments