Browse Source

Turn on ASN map for peer bucketing by default

The -asmap CLI arg now is given data by default, the first cryptocoin
that I am aware doing this. Bitcoin Core has let asmap stuff languish
on branches and PRs for a very long time, and it indeed has improved,
but people in the streets needs something Right Now.

In Bitcoin Core, -asmap is turned off by default and additionally, it's
quite annoying to generate the file to give to it, which is not included
with Bitcoin Core for either licensing or drama reasons, pick one.

bitcoin-asmap looks promising, but still, will not be enabled by
default, if it ever is merged:

https://github.com/bitcoin/bitcoin/pull/18573

In Hush, we decided to turn it ON BY DEFAULT and additionally,
revolutionarily, we give users the fucking data to use the damn feature,
by default, without them having to do anything. Ignorance is bliss, just
like Extreme Privacy.

Recently SD 1.1.1 learned to do this in it's own inimitable way, so that
release supports this feature without having Hush 3.6.2.

Why is ASN mapping always better than /16 (Class B) Bucketing?

It's just basic math.

  * A /16 means 65K "buckets" that a peer can be put into
  * Current (Jan 2020) ASN map has 7.4M buckets

That means the ASN bucketing method has over 100000 times more buckets
to put peers into, which means finer-grained filtering of peers
into actual logical networks intead of just IP addresses that are close.

Even an old out of date ASN map will always bucket peers better than a
/16, and all cryptocoins should migrate to doing this by default.

The main reason for this ASN bucketing is to defend against P2P layer
attacks such as the "Erebus Attack"

https://erebus-attack.comp.nus.edu.sg/
pull/32/head
Duke 3 years ago
parent
commit
25aaca1283
  1. 1
      src/hushd
  2. 6
      src/init.cpp

1
src/hushd

@ -86,6 +86,7 @@ $KMD -ac_name=$NAME \
-ac_supply=$SUPPLY \
-ac_perc=$PERC \
-clientname=$CLIENTNAME \
-asmap \
-addnode=$NODE1 \
-addnode=$NODE2 \
-addnode=$NODE3 \

6
src/init.cpp

@ -1093,11 +1093,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
char cwd[1024];
bool ret = getcwd(cwd, sizeof(cwd));
fs::path pwd = fs::path(cwd);
fs::path contrib = pwd / "contrib" / "asmap";
fs::path contrib = pwd / ".." / "contrib" / "asmap";
// if no filepath, use the default in contrib
if (asmap_path.empty()) {
asmap_path = pwd / DEFAULT_ASMAP_FILENAME;
asmap_path = contrib / DEFAULT_ASMAP_FILENAME;
}
if (!asmap_path.is_absolute()) {
asmap_path = GetDataDir() / asmap_path;
@ -1112,10 +1112,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return false;
}
const uint256 asmap_version = SerializeHash(asmap);
printf("%s: asmap version=%s with %lu mappings\n", __func__, asmap_version.ToString().c_str(), asmap.size());
addrman.m_asmap = std::move(asmap); // //node.connman->SetAsmap(std::move(asmap));
LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
printf("%s: asmap version=%s with %d mappings\n", __func__, asmap_version.ToString(), asmap.size());
} else {
LogPrintf("Using /16 prefix for IP bucketing, but why?\n");
}

Loading…
Cancel
Save