Giter Site home page Giter Site logo

matoking / nanolib Goto Github PK

View Code? Open in Web Editor NEW
65.0 5.0 11.0 1021 KB

Python library for working with the NANO cryptocurrency protocol

License: Creative Commons Zero v1.0 Universal

Python 6.09% C 88.95% Roff 0.07% Makefile 0.18% C# 4.71%
python3 python nanocurrency unmaintained

nanolib's People

Contributors

laurentiu-andronache avatar matoking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nanolib's Issues

Troubles installing on aarch64

Hello, I'm having troubles installing nanolib on aarch64.
I'm using Raspberry Pi 4 + Ubuntu server.

This library is a requirment in order to install pippin-wallet.

Let me know if you need more details. Good day

error1
error2

Support work threshold/difficulty multiplier

Thanks for this library, we've been using it for our service DPoW.

A few suggestions:

  1. The nano node is using difficulty rather than threshold in every work related RPC, perhaps it would be good to change the semantics before the next major version update. See https://docs.nano.org/commands/rpc-protocol/#work_generate
  2. Work multipliers are useful to know how much "more difficult" a certain work is. I have a gist here (use as you wish) with the code to do this. Similar code has been pushed to the next Nano node version here.
  3. A function to check the difficulty of a proof would be great as well.

I can obviously use my own two small functions to accomplish this, but since this librar is so complete I thought I'd make the suggestion.

Unable to Install Pippin Wallet on Microsoft Windows 10 (64-Bit) - "fatal error C1083: Cannot open include file: 'sched.h': No such file or directory"

When trying install the wallet via the pip install pippin-wallet command I am continuing the receive the follow error when attempting to build the wheel for nanolib fatal error C1083: Cannot open include file: 'sched.h': No such file or directory.

I've updated all the compilers and headers for C/C++ in Visual Studio 2017, but am still running into the error. I'm using Git Bash but have run into the same error on the command line as well.

Solving work taking forever

Hi,

Solving work takes 60+ seconds for me. Any idea what could cause this?

I am also very confused as to how you get to these benchmarks:

 This based on a Ryzen 1800X giving the following results:
# avx speed: 6185344 hashes/s (this is likely the fastest on Intel CPUs)
# sse4_1 speed: 6259267 hashes/s
# ssse3 speed: 6249287 hashes/s
# sse2 speed: 4635929 hashes/s
# ref speed: 4539306 hashes/s

This is significantly faster than what I get when I run your benchmark (python setup.py speed):

BLAKE2b PoW (avx) DEFAULT speed: 1653567 hashes/s
BLAKE2b PoW (sse4_1) speed: 1685205 hashes/s
BLAKE2b PoW (ssse3) speed: 1542921 hashes/s
BLAKE2b PoW (sse2) speed: 1195275 hashes/s
BLAKE2b PoW (ref) speed: 1448130 hashes/s
Account generation rate: 674 accounts/s
Block sign rate: 444 blocks/s
Block verify rate: 380 blocks/s

Unless you're using all cores for that? your benchmark is only single core though?

This is my CPU spec:

vendor_id       : AuthenticAMD
cpu family      : 23
model           : 113
model name      : AMD Ryzen 9 3950X 16-Core Processor
stepping        : 0
microcode       : 0x8701021
cpu MHz         : 2200.000
cache size      : 512 KB
physical id     : 0
siblings        : 32
core id         : 0
cpu cores       : 16
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 16
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sme sev sev_es
bugs            : sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass
bogomips        : 6989.22
TLB size        : 3072 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14]

I can run nault.cc locally and send transactions every second or faster. So why the PoW generation so slow in nanolib?

V21 difficulty update

The Nano node has been recently updated to version 21 (protocol v18), which sets up an updated, higher base difficulty for blocks. The network upgrade to reject blocks below the current difficulty will be performed using epoch blocks. For full details, refer to the documentation page on network upgrades , and the work generation guide.

In order to support the change by default for any clients using nanolib, it would be necessary to update the base difficulty to fffffff800000000 here at some point.

The difficulty is already an optional value to solving work though, and solve_work has to be called explicitly. This means the flexibility for users of this library is already there, which is great.

Error

I have error:

Traceback (most recent call last):
  File "test.py", line 14, in <module>
    balance=10000000000000000000000000
  File "/usr/local/lib/python3.7/dist-packages/nanolib/blocks.py", line 245, in __init__
    setattr(self, key, value)
  File "/usr/local/lib/python3.7/dist-packages/nanolib/blocks.py", line 83, in wrapper
    setter(self, new)
  File "/usr/local/lib/python3.7/dist-packages/nanolib/blocks.py", line 103, in wrapper
    setter(self, val)
  File "/usr/local/lib/python3.7/dist-packages/nanolib/blocks.py", line 116, in wrapper
    setter(self, val)
  File "/usr/local/lib/python3.7/dist-packages/nanolib/blocks.py", line 739, in set_previous
    validate_public_key(previous)
  File "/usr/local/lib/python3.7/dist-packages/nanolib/accounts.py", line 85, in validate_public_key
    if len(public_key) != 64 or not is_hex(public_key):
TypeError: object of type 'property' has no len()

[Suggestion] Less verbose function names

I think some function could be changed (or aliased for retrocompatibily reasons), like:
generate_account_private_key -> derive_private_key
generate_account_id -> derive_address

I don't know the lib very deeply, but I believe there are some other similar cases.

Lack of a list of requirements in nanolib

First, when I open https://github.com/Matoking/nanolib there's no place on the page saying how to import nanolib. I would suggest to put a line saying something like:
"Installation: If you are using Linux, open terminal and type pip install nanolib"

I encountered some errors when trying to: pip install nanolib
It was necessary to type this commands first:

sudo apt install build-essential

So, we need a list of requirements in nanolib github. Also, there nothing on documentation saying how to install it properly, or what is required to install before installing Nanolib.

Don't install on CentOS

Collecting nanolib
Using cached https://files.pythonhosted.org/packages/db/a8/af0f8110b7a40c65e10d0e0c635fc4b338bd9cd7e07d5b50cbee41c00202/nanolib-0.4.2.tar.gz
Collecting ed25519-blake2b>=1.4 (from nanolib)
Using cached https://files.pythonhosted.org/packages/1d/f1/035bafb5b2ed5b379abd4bf26ebad6e9fed73e21756971cefe027bd55ec2/ed25519-blake2b-1.4.tar.gz
Collecting py-cpuinfo>=4 (from nanolib)
Using cached https://files.pythonhosted.org/packages/f6/f5/8e6e85ce2e9f6e05040cf0d4e26f43a4718bcc4bce988b433276d4b1a5c1/py-cpuinfo-7.0.0.tar.gz
Installing collected packages: ed25519-blake2b, py-cpuinfo, nanolib
Running setup.py install for ed25519-blake2b ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-bmrg6xzj/ed25519-blake2b/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-v42xaj_n-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/ed25519_blake2b
copying src/ed25519/_version.py -> build/lib.linux-x86_64-3.6/ed25519_blake2b
copying src/ed25519/test_ed25519.py -> build/lib.linux-x86_64-3.6/ed25519_blake2b
copying src/ed25519/init.py -> build/lib.linux-x86_64-3.6/ed25519_blake2b
copying src/ed25519/keys.py -> build/lib.linux-x86_64-3.6/ed25519_blake2b
UPDATING build/lib.linux-x86_64-3.6/ed25519_blake2b/_version.py
set build/lib.linux-x86_64-3.6/ed25519_blake2b/_version.py to '1.4'
running build_ext
building 'ed25519_blake2b._ed25519' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
creating build/temp.linux-x86_64-3.6/src/ed25519-glue
creating build/temp.linux-x86_64-3.6/src/ed25519-supercop-ref
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isrc/ed25519-supercop-ref -I/usr/include/python3.6m -c src/ed25519-glue/ed25519module.c -o build/temp.linux-x86_64-3.6/src/ed25519-glue/ed25519module.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-bmrg6xzj/ed25519-blake2b/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-v42xaj_n-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-bmrg6xzj/ed25519-blake2b/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.