Skip to content

Commit

Permalink
Replace secp256k1 by secp256k1prp which is better maintained and avai…
Browse files Browse the repository at this point in the history
…lable on more platforms
  • Loading branch information
holgern committed Jan 12, 2019
1 parent 783e3e0 commit dc3812d
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
name: install dependencies
command: |
sudo python -m pip install -r requirements-test.txt
sudo python -m pip install --upgrade secp256k1
sudo python -m pip install --upgrade secp256k1prp
# run tests!
# this example uses Django's built-in test-runner
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ before_install:
- pip install --upgrade pip
- pip install --upgrade wheel
# Set numpy version first, other packages link against it
- pip install six nose coverage codecov tox-travis pytest pytest-cov coveralls codacy-coverage parameterized secp256k1 cryptography scrypt
- pip install six nose coverage codecov tox-travis pytest pytest-cov coveralls codacy-coverage parameterized secp256k1prp cryptography scrypt
- pip install pycryptodomex pyyaml appdirs pylibscrypt
- pip install ecdsa requests future websocket-client pytz six Click events prettytable

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Changelog
=========
0.20.17
-------
* Fix transfer rounding error, which prevent transfering of e.g. 1.013 STEEM.
* get_account_votes works again with api.steemit.com
* Use secp256k1prp as better replacement for secp256k1

0.20.16
-------
* Fix beempy walletinfo and sign
Expand Down
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ Signing and Verify can be fasten (200 %) by installing cryptography:
pip install -U cryptography
or:

.. code:: bash
pip install -U secp256k1prp
Install or update beem by pip::

pip install -U beem
Expand Down
17 changes: 11 additions & 6 deletions beemgraphenebase/ecdsasig.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@
GMPY2_MODULE = False
if not SECP256K1_MODULE:
try:
import secp256k1
import secp256k1prp as secp256k1
SECP256K1_MODULE = "secp256k1"
SECP256K1_AVAILABLE = True
except ImportError:
except:
try:
import cryptography
SECP256K1_MODULE = "cryptography"
CRYPTOGRAPHY_AVAILABLE = True
import secp256k1
SECP256K1_MODULE = "secp256k1"
SECP256K1_AVAILABLE = True
except ImportError:
SECP256K1_MODULE = "ecdsa"
try:
import cryptography
SECP256K1_MODULE = "cryptography"
CRYPTOGRAPHY_AVAILABLE = True
except ImportError:
SECP256K1_MODULE = "ecdsa"

try:
from cryptography.hazmat.backends import default_backend
Expand Down
18 changes: 12 additions & 6 deletions beemgraphenebase/signedtransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@
log = logging.getLogger(__name__)

try:
import secp256k1
import secp256k1prp as secp256k1
USE_SECP256K1 = True
log.debug("Loaded secp256k1 binding.")
except Exception:
USE_SECP256K1 = False
log.debug("To speed up transactions signing install \n"
" pip install secp256k1")
log.debug("Loaded secp256k1prp binding.")
except:
try:
import secp256k1
USE_SECP256K1 = True
log.debug("Loaded secp256k1 binding.")
except Exception:
USE_SECP256K1 = False
log.debug("To speed up transactions signing install \n"
" pip install secp256k1\n"
"or pip install secp256k1prp")


class Signed_Transaction(GrapheneObject):
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pycryptodomex==3.7.2
scrypt==0.8.6
Events==0.3
cryptography==2.4.2
pyyaml==3.13
pyyaml>=4.2b1
mock==2.0.0
appdirs==1.4.3
Click==7.0
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ deps =
secp256k1
scrypt
commands =
coverage run --parallel-mode -m pytest tests/beem tests/beemapi tests/beembase tests/beemgraphene {posargs}
coverage run --parallel-mode -m pytest {posargs}
coverage combine
coverage report -m
coverage xml
Expand All @@ -47,7 +47,7 @@ deps =
secp256k1
scrypt
commands =
coverage run --parallel-mode -m pytest tests/beem tests/beemapi tests/beembase tests/beemgraphene {posargs}
coverage run --parallel-mode -m pytest {posargs}
coverage combine
coverage report -m
coverage xml
Expand Down

0 comments on commit dc3812d

Please sign in to comment.