Aeon is one of the lighter versions of CryptoNight based crypto currencies.
AEON uses the CryptoNight-Lite POW. CryptoNight(popularized by Monero) and CryptoNight-lite are identical except for the size of the scratchpad needed (1mb vs 2mb). The original CryptoNight proof of work calls for a 2mb scratchpad, which means for every CryptoNight(Monero) mining thread there needs to be 2mb of CPU cache available. AEON reduces this requirement to 1mb of cache per thread thus increasing the amount of work a processor can do when hitting a CPU cache constraint.
During this exercise we will see how to port the source-code to be able to run the Aeon simplewallet and simpleminer programs.
The source-code is available via git here https://github.com/aeonix/aeon
Pre-requisites:
GCC 4.7.3 or later, CMake 2.8.6 or later, and Boost 1.53 or later. I have built all the needed things via pkgsrc-current on the Ci20 (GCC you can use the native one ) I have compiled all the pkgsrc packages for the Debian8 Ci20 NAND image here : https://45.76.81.249:8000/pkgsrc/debian8-ci20/All/
Building :
On the Ci20 device
# git clone https://github.com/aeonix/aeon.git # cd aeon # mkdir dist # cd dist # cmake ..
This should create the Makefiles in the dist project directory. Also we need to decide what exactly we will be building.
root@ci20:~/aeon/dist# make help The following are some of the valid targets for this Makefile: ... all (the default if no target is provided) ... clean ... depend ... install/local ... install ... rebuild_cache ... install/strip ... edit_cache ... test ... list_install_components ... version ... libminiupnpc-static ... cryptonote_core ... wallet ... common ... crypto ... ringct ... daemon ... simpleminer ... connectivity_tool ... rpc ... simplewallet ... tests ... net_load_tests_srv ... functional_tests ... performance_tests ... crypto-tests ... hash-tests ... unit_tests ... difficulty-tests ... hash-target-tests ... net_load_tests_clt ... coretests ... core_proxy ... gtest_main ... gtest root@ci20:~/aeon/dist#
Please note that building the daemon will make absolutely no sense on the Ci20 board, since the aeond (used to sync the blockchain) stores the blockchain in RAM and you would need something like 16 Gb ram + 12 Gb ssd swap. We will be building only the simplewallet and simpleminer (you can also build the test modules)
Now we need to touch the original code a little since we are building this on mips architecture. Here is a first error we will get when running make
root@ci20:~/aeon/dist# make simplewallet [ 0%] Built target version Scanning dependencies of target libminiupnpc-static [ 1%] Building C object external/miniupnpc/CMakeFiles/libminiupnpc-static.dir/igd_desc_parse.c.o cc: error: unrecognized command line option ‘-maes’ external/miniupnpc/CMakeFiles/libminiupnpc-static.dir/build.make:62: recipe for target 'external/miniupnpc/CMakeFiles/libminiupnpc-static.dir/igd_desc_parse.c.o' failed
We can fix the above quite easily (the Ci20 mips CPU does not support the -maes option since it is only for x86 https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html ) and ppc64 , but definitely not for 32 bit dev boards (mips,arm) so we change it via sed
root@ci20:~/aeon/dist# grep -lRZ '\-maes' . | xargs -0 -l sed -i -e 's/\-maes//g'
Once we get rid of all the -maes options in the Makefiles we move on and end up after a long time with another error
root@ci20:~/aeon/dist# make simplewallet [52%] Linking CXX executable simplewallet libwallet.a(wallet2.cpp.o): In function `std::__atomic_base<unsigned long long>::operator++()': /usr/include/c++/4.9/bits/atomic_base.h:408: undefined reference to `__atomic_fetch_add_8'
Now the above can be simply fixed by adding the -latomic to the link file for simplewallet link.txt
root@ci20:~/aeon/dist# vi ./src/CMakeFiles/simplewallet.dir/link.txt add -latomic to the end of the file so it looks like this /usr/bin/c++ -std=c++11 -D_GNU_SOURCE -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-reorder -Wno-missing-field-initializers -march=native -g -DNDEBUG -rdynamic CMakeFiles/simplewallet.dir/simplewallet/password_container.cpp.o CMakeFiles/simplewallet.dir/simplewallet/simplewallet.cpp.o -o simplewallet -Wl,-rpath,/usr/pkg/lib libwallet.a librpc.a libcryptonote_core.a libcrypto.a libcommon.a libringct.a ../external/miniupnpc/libminiupnpc.a -lpthread /usr/pkg/lib/libboost_system.so /usr/pkg/lib/libboost_filesystem.so /usr/pkg/lib/libboost_thread.so /usr/pkg/lib/libboost_date_time.so /usr/pkg/lib/libboost_chrono.so /usr/pkg/lib/libboost_regex.so /usr/pkg/lib/libboost_serialization.so /usr/pkg/lib/libboost_program_options.so /usr/pkg/lib/libboost_atomic.so -lrt -lpthread -latomic
Continue with the build
root@ci20:~/aeon/dist# make simplewallet [100%] Built target simplewallet root@ci20:~/aeon/dist# make simpleminer [ 11%] Built target ringct [ 35%] Built target cryptonote_core [ 44%] Built target common [ 94%] Built target crypto Scanning dependencies of target simpleminer [ 97%] Building CXX object src/CMakeFiles/simpleminer.dir/miner/simpleminer.cpp.o [100%] Linking CXX executable simpleminer [100%] Built target simpleminer
If you wish to build the test suites you will need to add the -atomic to their corresponding linker files
root@ci20:~/aeon/dist# vi ./tests/CMakeFiles/performance_tests.dir/link.txt add -latomic to the end root@ci20:~/aeon/dist# vi ./tests/CMakeFiles/unit_tests.dir/link.txt add -latomic to the end root@ci20:~/aeon/dist# vi ./tests/CMakeFiles/coretests.dir/link.txt add -latomic to the end root@ci20:~/aeon/dist# vi ./tests/CMakeFiles/core_proxy.dir/link.txt add -latomic to the end
The binaries are located here
root@ci20:~/aeon/dist/src# ls -alstr total 178376 4 -rw-r--r-- 1 root root 1118 Mar 15 06:09 cmake_install.cmake 56 -rw-r--r-- 1 root root 56618 Mar 15 06:09 Makefile 4 -rw-r--r-- 1 root root 246 Mar 15 06:09 CTestTestfile.cmake 0 drwxr-xr-x 12 root root 1056 Mar 15 06:09 CMakeFiles 0 drwxr-xr-x 8 root root 872 Mar 15 06:13 .. 20776 -rw-r--r-- 1 root root 21272790 Mar 15 06:24 librpc.a 54616 -rw-r--r-- 1 root root 55925862 Mar 15 06:51 libcryptonote_core.a 44616 -rw-r--r-- 1 root root 45685940 Mar 15 07:13 libwallet.a 2888 -rw-r--r-- 1 root root 2953342 Mar 15 07:18 libcommon.a 1884 -rw-r--r-- 1 root root 1929188 Mar 15 07:20 libcrypto.a 5084 -rw-r--r-- 1 root root 5205088 Mar 15 07:25 libringct.a 36352 -rwxr-xr-x 1 root root 37221816 Mar 15 07:37 simplewallet 12096 -rwxr-xr-x 1 root root 12385100 Mar 15 18:37 simpleminer 0 drwxr-xr-x 3 root root 1048 Mar 15 21:54 .
We can copy the two binaries somewhere else, here are the shared libraries used by the programs
root@ci20:~/bin# ldd simpleminer libpthread.so.0 => /lib/mipsel-linux-gnu/libpthread.so.0 (0x7722f000) libboost_system.so.1.66.0 => /usr/pkg/lib/libboost_system.so.1.66.0 (0x7721b000) libboost_filesystem.so.1.66.0 => /usr/pkg/lib/libboost_filesystem.so.1.66.0 (0x771ef000) libboost_thread.so.1.66.0 => /usr/pkg/lib/libboost_thread.so.1.66.0 (0x771bc000) libboost_date_time.so.1.66.0 => /usr/pkg/lib/libboost_date_time.so.1.66.0 (0x7719b000) libboost_chrono.so.1.66.0 => /usr/pkg/lib/libboost_chrono.so.1.66.0 (0x77184000) libboost_regex.so.1.66.0 => /usr/pkg/lib/libboost_regex.so.1.66.0 (0x77047000) libboost_serialization.so.1.66.0 => /usr/pkg/lib/libboost_serialization.so.1.66.0 (0x77004000) libboost_program_options.so.1.66.0 => /usr/pkg/lib/libboost_program_options.so.1.66.0 (0x76f78000) libboost_atomic.so.1.66.0 => /usr/pkg/lib/libboost_atomic.so.1.66.0 (0x76f66000) librt.so.1 => /lib/mipsel-linux-gnu/librt.so.1 (0x76f4e000) libstdc++.so.6 => /usr/lib/mipsel-linux-gnu/libstdc++.so.6 (0x76e3c000) libm.so.6 => /lib/mipsel-linux-gnu/libm.so.6 (0x76dac000) libgcc_s.so.1 => /lib/mipsel-linux-gnu/libgcc_s.so.1 (0x76d73000) libc.so.6 => /lib/mipsel-linux-gnu/libc.so.6 (0x76bf0000) /lib/ld.so.1 (0x7727b000) libicudata.so.60 => /usr/pkg/lib/libicudata.so.60 (0x75238000) libicui18n.so.60 => /usr/pkg/lib/libicui18n.so.60 (0x74f43000) libicuuc.so.60 => /usr/pkg/lib/libicuuc.so.60 (0x74d68000) libdl.so.2 => /lib/mipsel-linux-gnu/libdl.so.2 (0x74d55000) root@ci20:~/bin# ldd simplewallet libpthread.so.0 => /lib/mipsel-linux-gnu/libpthread.so.0 (0x77f88000) libboost_system.so.1.66.0 => /usr/pkg/lib/libboost_system.so.1.66.0 (0x77f74000) libboost_filesystem.so.1.66.0 => /usr/pkg/lib/libboost_filesystem.so.1.66.0 (0x77f48000) libboost_thread.so.1.66.0 => /usr/pkg/lib/libboost_thread.so.1.66.0 (0x77f15000) libboost_date_time.so.1.66.0 => /usr/pkg/lib/libboost_date_time.so.1.66.0 (0x77ef4000) libboost_chrono.so.1.66.0 => /usr/pkg/lib/libboost_chrono.so.1.66.0 (0x77edd000) libboost_regex.so.1.66.0 => /usr/pkg/lib/libboost_regex.so.1.66.0 (0x77da0000) libboost_serialization.so.1.66.0 => /usr/pkg/lib/libboost_serialization.so.1.66.0 (0x77d5d000) libboost_program_options.so.1.66.0 => /usr/pkg/lib/libboost_program_options.so.1.66.0 (0x77cd1000) libboost_atomic.so.1.66.0 => /usr/pkg/lib/libboost_atomic.so.1.66.0 (0x77cbf000) librt.so.1 => /lib/mipsel-linux-gnu/librt.so.1 (0x77ca7000) libatomic.so.1 => /usr/lib/mipsel-linux-gnu/libatomic.so.1 (0x77c92000) libstdc++.so.6 => /usr/lib/mipsel-linux-gnu/libstdc++.so.6 (0x77b7f000) libm.so.6 => /lib/mipsel-linux-gnu/libm.so.6 (0x77af0000) libgcc_s.so.1 => /lib/mipsel-linux-gnu/libgcc_s.so.1 (0x77ab7000) libc.so.6 => /lib/mipsel-linux-gnu/libc.so.6 (0x77934000) /lib/ld.so.1 (0x77fd4000) libicudata.so.60 => /usr/pkg/lib/libicudata.so.60 (0x75f7b000) libicui18n.so.60 => /usr/pkg/lib/libicui18n.so.60 (0x75c87000) libicuuc.so.60 => /usr/pkg/lib/libicuuc.so.60 (0x75aac000) libdl.so.2 => /lib/mipsel-linux-gnu/libdl.so.2 (0x75a98000) root@ci20:~/bin#
I have uploaded the binaries here if needed https://45.76.81.249:8000/pkgsrc/debian8-ci20/aeon/
OK, now we have compiled the two, we can test is it works, first the simplewallet
root@ci20:~/bin# ./simplewallet aeon wallet v0.9.14.0() Specify wallet file name (e.g., wallet.bin). If the wallet doesn't exist, it will be created. Wallet file name: ci20wallet The wallet doesn't exist, generating new one password: ****************** <---cut----> [wallet XXX111]:
OK, so this works, but we have no access to the Aeon blockchain, so we should use some public Aeon node and connect to it (via a following shell script for example)
root@ci20:~/bin# cat run.wallet.sh ./simplewallet --wallet-file=./ci20wallet --daemon-address phx-1.snipanet.com:11181
The initial sync with all the transactions will take some time, so be patient. Do not forget to save the sync data once done. There are multiple online Aeon nodes listed here : https://aeon.wiki/Node
It took approximately 3 hours to sync the simplewallet
Refresh done, blocks received: 257191 balance: 0.000000000000, unlocked balance: 0.000000000000 ********************************************************************** Use "help" command to see the list of available commands. ********************************************************************** [wallet XXX111]: [wallet XXX111]:
Next we can try the simpleminer
root@ci20:~/bin# ./simpleminer --pool-addr mine.somepool.com:3333 --login walletaddress --pass x 2018-Mar-15 22:16:15.252403 Connecting mine.somepool.com:3333.... 2018-Mar-15 22:16:15.285706 Connected mine.somepool.com:3333 OK 2018-Mar-15 22:16:15.302291 READ ENDS: Success. bytes_tr: 79 2018-Mar-15 22:16:15.303819 READ ENDS: Connection err_code 2 2018-Mar-15 22:16:15.304637 Connection err_code eof. 2018-Mar-15 22:16:15.305173 Returning false because of wrong state machine. state: 5 2018-Mar-15 22:16:15.305650 Failed to invoke http request to / 2018-Mar-15 22:16:15.306115 Failed to invoke login mine.somepool.com:3333, disconnect and sleep....
Hmm so it looks like the simple miner does not work, It would make no sense anyway on the Ci20 device, maybe its possible to use it from the simplewallet ? But for that you need to wait till your device synces the blokchain transactions via the public Aeon Nodes.