Files
tor/src/ext/equix
Micah Elizabeth Scott a3e7e9bda2 equix: Disable huge page support by default
Equi-X supports optionally allocating its solver memory using huge
pages, to reduce the virtual memory subsystem overhead required to make
the entire solver buffer live.

Tor doesn't use this feature, since it seems to have no noticeable
performance benefit at this time, but we still included code for it at
compile time. To improve portability, this patch disables huge page
support by default and enables it only in the cmake build system used
for equix benchmarks.

With this patch equix-bench still supports huge pages. Verified using
strace that we're making the hugepage allocation.

There's no fallback for huge pages, so Equi-X initialization will fail
if they are requested and we don't support them for any runtime or
compile-time reason.

Addresses #40843 (NetBSD) but also prevents future porting issues
related to huge pages.
2023-08-28 10:11:00 -07:00
..
2023-05-10 07:37:10 -07:00
2023-05-10 07:37:10 -07:00
2023-05-10 07:37:10 -07:00

Equi-X

Equi-X is a CPU-friendly client puzzle with fast verification and small solution size (16 bytes). It is based on Equihash(60,3) with two major changes:

  1. Blake2b hash function is replaced with HashX.
  2. XOR is replaced with modular addition.

An Equi-X solution for nonce X is a set of eight 16-bit indices i0, ..., i7 such that:

HX(i0) + HX(i1) + HX(i2) + HX(i3) + HX(i4) + HX(i5) + HX(i6) + HX(i7) = 0 (mod 260)

where HX is a HashX function generated for nonce X. Equi-X is therefore a variant of the subset sum problem. Each nonce value provides 2 solutions on average.

Equi-X also has additional requirements that prove that the solution was found using the Wagner's algorithm. See the Equihash paper for details.

Example solution

H(0x6c31) = 0xcfa5375c0a7f5d7 \
                              (+) = 0xa73d9777f110000 \
H(0x8803) = 0xd798601be690a29 /                        |
                                                      (+) = 0xefdaadb00000000 \
H(0x80c2) = 0xcabd8974bbee8d5 \                        |                       |
                              (+) = 0x489d16380ef0000 /                        |
H(0xa1db) = 0x7ddf8cc3530172b /                                                |
                                                                              (+) = 0
H(0x6592) = 0x348a96fd685dcba \                                                |
                              (+) = 0x357120e8ffb8000 \                        |
H(0x76b7) = 0x00e689eb975a346 /                        |                       |
                                                      (+) = 0x102552500000000 /
H(0x74a6) = 0xacccc4ad2d06bcd \                        |
                              (+) = 0xdab431670048000 /
H(0xe259) = 0x2de76cb9d341433 /

Performance

Algorithm n k memory solution size verification 1 CPU perf. 2 GPU perf. 3
Equi-X 60 3 1.8 MiB 16 bytes ~50 μs 2400 Sol/s ?
Zcash 200 9 144 MiB 1344 bytes >150 μs 30 Sol/s ~400 Sol/s 4
BTG 144 5 2.5 GiB 100 bytes ~10 μs 1 Sol/s ~45 Sol/s 5
  1. Using AMD Ryzen 1700 with 1 thread.
  2. Using AMD Ryzen 1700 with 16 threads.
  3. Using NVIDIA GTX 1660 Ti.
  4. Estimated from http://www.zcashbenchmarks.info/ (GTX 1070)
  5. Estimated from https://miniz.ch/features/

Build

git clone --recursive https://github.com/tevador/equix.git
cd equix
mkdir build
cd build
cmake ..
make
./equix-tests
./equix-bench --help

Design notes

See devlog.md

Donations

You can support the development of Equi-X by sending XMR to this address:

85GkKXSD8EQ22EMC2ZKF64S6L6Lcm8Gr23VbAKB1zg6FUW81sUEmrvvRPoM3GCpUZSC9azCLdeityW2N3CVsV4CAC3p1evV