iron-fish / fish-hash Goto Github PK
View Code? Open in Web Editor NEWA work in progress implementation of Iron Fish's new mining algorithm FishHash
A work in progress implementation of Iron Fish's new mining algorithm FishHash
Hello beautiful devs,
I have been desperately trying to build the C++ implementation of fishhash
. Any help would be truly appreciated:
g++ -g -Wall -fPIC -fpermissive -O2 -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-sign-compare -std=c++11 -maes -msse2 -mssse3 -mpclmul -mavx -mavx2 -c -o ethash/progpow.o ethash/progpow.cpp
g++ -shared -o libkawpow.so ethash/ethash.o keccak/keccak.o keccak/keccakf800.o keccak/keccakf1600.o ethash/managed.o ethash/primes.o ethash/progpow.o
rm -f libfishhash.so 3rdParty/blake3.o 3rdParty/blake3_dispatch.o 3rdParty/blake3_portable.o 3rdParty/keccak.o FishHash.o
cc -g -Wall -c -fPIC -O2 -Wno-pointer-sign -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-discarded-qualifiers -Wno-unused-const-variable -maes -msse2 -mssse3 -mpclmul -mavx -mavx2 -c -o 3rdParty/blake3.o 3rdParty/blake3.c
cc -g -Wall -c -fPIC -O2 -Wno-pointer-sign -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-discarded-qualifiers -Wno-unused-const-variable -maes -msse2 -mssse3 -mpclmul -mavx -mavx2 -c -o 3rdParty/blake3_dispatch.o 3rdParty/blake3_dispatch.c
cc -g -Wall -c -fPIC -O2 -Wno-pointer-sign -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-discarded-qualifiers -Wno-unused-const-variable -maes -msse2 -mssse3 -mpclmul -mavx -mavx2 -c -o 3rdParty/blake3_portable.o 3rdParty/blake3_portable.c
cc -g -Wall -c -fPIC -O2 -Wno-pointer-sign -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-discarded-qualifiers -Wno-unused-const-variable -maes -msse2 -mssse3 -mpclmul -mavx -mavx2 -c -o 3rdParty/keccak.o 3rdParty/keccak.c
g++ -g -Wall -fPIC -fpermissive -O2 -funroll-loops -fomit-frame-pointer -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-sign-compare -std=c++11 -maes -msse2 -mssse3 -mpclmul -mavx -mavx2 -c -o FishHash.o FishHash.cpp
In file included from 3rdParty/blake3.c:7,
from FishHash.cpp:6:
3rdParty/blake3_dispatch.c: In function ‘cpu_feature get_cpu_features()’:
3rdParty/blake3_dispatch.c(95,33): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
95 | enum cpu_feature features = 0;
| ^
| |
| int
3rdParty/blake3_dispatch.c(100,14): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
100 | features |= SSE2;
| ~~~~~~~~~^~~~~~~
| |
| int
3rdParty/blake3_dispatch.c(106,16): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
106 | features |= SSSE3;
| ~~~~~~~~~^~~~~~~~
| |
| int
3rdParty/blake3_dispatch.c(108,16): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
108 | features |= SSE41;
| ~~~~~~~~~^~~~~~~~
| |
| int
3rdParty/blake3_dispatch.c(114,20): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
114 | features |= AVX;
| ~~~~~~~~~^~~~~~
| |
| int
3rdParty/blake3_dispatch.c(118,22): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
118 | features |= AVX2;
| ~~~~~~~~~^~~~~~~
| |
| int
3rdParty/blake3_dispatch.c(121,24): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
121 | features |= AVX512VL;
| ~~~~~~~~~^~~~~~~~~~~
| |
| int
3rdParty/blake3_dispatch.c(123,24): warning G738B250A: invalid conversion from ‘int’ to ‘cpu_feature’ [-fpermissive] [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
123 | features |= AVX512F;
| ~~~~~~~~~^~~~~~~~~~
| |
| int
g++ -shared -o libfishhash.so 3rdParty/blake3.o 3rdParty/blake3_dispatch.o 3rdParty/blake3_portable.o 3rdParty/keccak.o FishHash.o
/usr/bin/ld: 3rdParty/blake3_dispatch.o: in function `blake3_compress_in_place':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:140: multiple definition of `blake3_compress_in_place'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:140: first defined here
/usr/bin/ld: 3rdParty/blake3_dispatch.o: in function `blake3_compress_xof':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:169: multiple definition of `blake3_compress_xof'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:169: first defined here
/usr/bin/ld: 3rdParty/blake3_dispatch.o: in function `blake3_hash_many':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:198: multiple definition of `blake3_hash_many'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:198: first defined here
/usr/bin/ld: 3rdParty/blake3_dispatch.o: in function `get_cpu_features':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:88: multiple definition of `blake3_simd_degree'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_dispatch.c:88: first defined here
/usr/bin/ld: 3rdParty/blake3_portable.o: in function `blake3_compress_in_place_portable':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_portable.c:101: multiple definition of `blake3_compress_in_place_portable'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_portable.c:101: first defined here
/usr/bin/ld: 3rdParty/blake3_portable.o: in function `blake3_compress_xof_portable':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_portable.c:120: multiple definition of `blake3_compress_xof_portable'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_portable.c:120: first defined here
/usr/bin/ld: 3rdParty/blake3_portable.o: in function `blake3_hash_many_portable':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_portable.c:166: multiple definition of `blake3_hash_many_portable'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_portable.c:166: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_version':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:11: multiple definition of `blake3_version'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:11: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_init':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:367: multiple definition of `blake3_hasher_init'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:367: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_init_keyed':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_impl.h:152: multiple definition of `blake3_hasher_init_keyed'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3_impl.h:152: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_update':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:464: multiple definition of `blake3_hasher_update'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:464: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_finalize_seek':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:578: multiple definition of `blake3_hasher_finalize_seek'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:578: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_finalize':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:568: multiple definition of `blake3_hasher_finalize'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:568: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_init_derive_key_raw':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:382: multiple definition of `blake3_hasher_init_derive_key_raw'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:382: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_init_derive_key':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:393: multiple definition of `blake3_hasher_init_derive_key'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:393: first defined here
/usr/bin/ld: FishHash.o: in function `blake3_hasher_reset':
/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:25: multiple definition of `blake3_hasher_reset'; 3rdParty/blake3.o:/home/ceedii/miningcore/src/Native/libfishhash/3rdParty/blake3.c:25: first defined here
collect2 : error : ld returned 1 exit status [/home/ceedii/miningcore/src/Miningcore/Miningcore.csproj]
make: *** [Makefile:11: libfishhash.so] Error 1
I also has an issue with the blake3_neon.c
file, i had to comment it in the blake3.c
file.
In the specification of FishHash algorithm https://github.com/iron-fish/fish-hash/blob/main/FishHash.pdf section 3.2 ReadDataSet subprogram MixValue
has offsets in bytes: 0, 32,64:
Algorithm 2 ReadDataSet
LoadValue[0:127] <- DataSet[MixValue[0:3] % dataSetSize]
LoadValue[128:255] <- DataSet[MixValue[32:35] % dataSetSize]
LoadValue[256:383] <- DataSet[MixValue[64:67] % dataSetSize]
But in your implementation (both C++ and Rust) they are 0, 16, 32:
Lines 260 to 262 in dfdd747
Lines 147 to 149 in dfdd747
sizeof(mix.word32s)
== 4 so we read from MixValue[0:3]
, MixValue[16:19]
, MixValue[32:35]
Corresponding to Lollidieb's paper indices should be mix.word32s[0]
, mix.word32s[8]
, mix.word32s[16]
.
Hello beautiful devs,
I have a question regarding the prebuilt dataset, even with 8 threads it makes more than 4 minutes to be generated, is there anyway to improve that process? I think people who will need to generate it with on a 4 threads server will definitely have an hard time.
I've noticed that the README doesn't include instructions for compiling and running the project.
I gave it a try on my computer, which is set up with Ubuntu 22.04 LTS under WSL2, featuring an x86-64 processor.
I encountered an error indicating that it couldn't locate the arm_neon.h
file. Upon further research, I found that this file pertains to an ARM library; however, since my compilation target is x86-64, theoretically, such an error shouldn't arise.
Moreover, upon examining the CMakeLists.txt
file, I observed that it specifies a version for macOS. Does that mean you compiled it on an ARM-based macOS?
If I wish to compile this on an x86-64 Ubuntu machine, what steps should I follow? I attempted modifying the CMakeLists.txt
file, changing the target architecture to x86-64, yet the compilation still fails, complaining about not finding the arm_neon.h
file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.