Python FFI bindings for libsecp256k1 (maintained)

Overview

secp256k1-py Build Status

Python FFI bindings for libsecp256k1 (an experimental and optimized C library for EC operations on curve secp256k1).

Previously maintained by Ludvig Broberg, now at https://github.com/rustyrussell/secp256k1-py .

Installation

pip install secp256k1

Precompiled binary packages (wheels)

Precompiled binary wheels is available for Python 2.7, 3.3, 3.4, and 3.5 on Linux. To take advantage of those you need to use pip >= 8.1.0.

In case you don't want to use the binary packages you can prevent pip from using them with the following command:

pip install --no-binary :all: secp256k1

Installation with compilation

If you either can't or don't want to use the binary package options described above read on to learn what is needed to install the source pacakge.

The library bundles its own libsecp256k1 currently, as there is no versioning to allow us to safely determine compatibility with an installed library, especially as we also build all the experimental modules.

For the bundled version to compile successfully you need to have a C compiler as well as the development headers for libffi and libgmp installed.

On Debian / Ubuntu for example the necessary packages are:

  • build-essential
  • automake
  • pkg-config
  • libtool
  • libffi-dev

On OS X the necessary homebrew packages are:

  • automake
  • pkg-config
  • libtool
  • libffi

Command line usage

Generate a private key and show the corresponding public key
$ python -m secp256k1 privkey -p

a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e
Public key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3
Sign a message
$ python -m secp256k1 sign \
	-k a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e \
	-m hello

3045022100a71d86190354d64e5b3eb2bd656313422cdf7def69bf3669cdbfd09a9162c96e0220713b81f3440bff0b639d2f29b2c48494b812fa89b754b7b6cdc9eaa8027cf369
Check signature
$ python -m secp256k1 checksig \
	-p 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3 \
	-m hello \
	-s 3045022100a71d86190354d64e5b3eb2bd656313422cdf7def69bf3669cdbfd09a9162c96e0220713b81f3440bff0b639d2f29b2c48494b812fa89b754b7b6cdc9eaa8027cf369

True
Generate a signature that allows recovering the public key
$ python -m secp256k1 signrec \
	-k a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e \
	-m hello

515fe95d0780b11633f3352deb064f1517d58f295a99131e9389da8bfacd64422513d0cd4e18a58d9f4873b592afe54cf63e8f294351d1e612c8a297b5255079 1
Recover public key
$ python -m secp256k1 recpub \
	-s 515fe95d0780b11633f3352deb064f1517d58f295a99131e9389da8bfacd64422513d0cd4e18a58d9f4873b592afe54cf63e8f294351d1e612c8a297b5255079 \
	-i 1 \
	-m hello

Public key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3

It is easier to get started with command line, but it is more common to use this as a library. For that, check the next sections.

API

class secp256k1.PrivateKey(privkey, raw, flags)

The PrivateKey class loads or creates a private key by obtaining 32 bytes from urandom and operates over it.

Instantiation parameters
  • privkey=None - generate a new private key if None, otherwise load a private key.
  • raw=True - if True, it is assumed that privkey is just a sequence of bytes, otherwise it is assumed that it is in the DER format. This is not used when privkey is not specified.
  • flags=secp256k1.ALL_FLAGS - see Constants.
Methods and instance attributes
  • pubkey: an instance of secp256k1.PublicKey.

  • private_key: raw bytes for the private key.

  • set_raw_privkey(privkey)
    update the private_key for this instance with the bytes specified by privkey. If privkey is invalid, an Exception is raised. The pubkey is also updated based on the new private key.

  • serialize() -> bytes
    convert the raw bytes present in private key to a hexadecimal string.

  • deserialize(privkey_ser) -> bytes
    convert from a hexadecimal string to raw bytes and update the pubkey and private_key for this instance.

  • tweak_add(scalar) -> bytes
    tweak the current private key by adding a 32 byte scalar to it and return a new raw private key composed of 32 bytes.

  • tweak_mul(scalar) -> bytes
    tweak the current private key by multiplying it by a 32 byte scalar and return a new raw private key composed of 32 bytes.

  • ecdsa_sign(msg, raw=False, digest=hashlib.sha256) -> internal object
    by default, create an ECDSA-SHA256 signature from the bytes in msg. If raw is True, then the digest function is not applied over msg, otherwise the digest must produce 256 bits or an Exception will be raised.

    The returned object is a structure from the C lib. If you want to store it (on a disk or similar), use ecdsa_serialize and later on use ecdsa_deserialize when loading.

  • ecdsa_sign_recoverable(msg, raw=False, digest=hashlib.sha256) -> internal object
    create a recoverable ECDSA signature. See ecdsa_sign for parameters description.

  • schnorr_sign(msg, bip340tag, raw=False) -> bytes

create a BIP-340 signature for msg; bip340tag should be a string or byte value which distinguishes this usage from any other usage of signatures (e.g. your program name, or full protocol name). If raw is specified, then bip340tag is not used, and the msg (usually a 32-byte hash) is signed directly.

It produces non-malleable 64-byte signatures which support batch validation.

class secp256k1.PublicKey(pubkey, raw, flags)

The PublicKey class loads an existing public key and operates over it.

Instantiation parameters
  • pubkey=None - do not load a public key if None, otherwise do.
  • raw=False - if False, it is assumed that pubkey has gone through PublicKey.deserialize already, otherwise it must be specified as bytes.
  • flags=secp256k1.FLAG_VERIFY - see Constants.
Methods and instance attributes
  • public_key: an internal object representing the public key.

  • serialize(compressed=True) -> bytes
    convert the public_key to bytes. If compressed is True, 33 bytes will be produced, otherwise 65 will be.

  • deserialize(pubkey_ser) -> internal object
    convert the bytes resulting from a previous serialize call back to an internal object and update the public_key for this instance. The length of pubkey_ser determines if it was serialized with compressed=True or not. This will raise an Exception if the size is invalid or if the key is invalid.

  • combine(pubkeys) -> internal object
    combine multiple public keys (those returned from PublicKey.deserialize) and return a public key (which can be serialized as any other regular public key). The public_key for this instance is updated to use the resulting combined key. If it is not possible the combine the keys, an Exception is raised.

  • tweak_add(scalar) -> internal object
    tweak the current public key by adding a 32 byte scalar times the generator to it and return a new PublicKey instance.

  • tweak_mul(scalar) -> internal object
    tweak the current public key by multiplying it by a 32 byte scalar and return a new PublicKey instance.

  • ecdsa_verify(msg, raw_sig, raw=False, digest=hashlib.sha256) -> bool
    verify an ECDSA signature and return True if the signature is correct, False otherwise. raw_sig is expected to be an object returned from ecdsa_sign (or if it was serialized using ecdsa_serialize, then first run it through ecdsa_deserialize). msg, raw, and digest are used as described in ecdsa_sign.

  • schnorr_verify(msg, schnorr_sig, bip340tag, raw=False) -> bool
    verify a Schnorr signature and return True if the signature is correct, False otherwise. schnorr_sig is expected to be the result from schnorr_sign, msg, bip340tag and raw must match those used in schnorr_sign.

  • ecdh(scalar, hashfn=ffi.NULL, hasharg=ffi.NULL) -> bytes
    compute an EC Diffie-Hellman secret in constant time. The instance public_key is used as the public point, and the scalar specified must be composed of 32 bytes. It outputs 32 bytes representing the ECDH secret computed. The hashing function can be overridden, but (unlike libsecp256k1 itself) we insist that it produce 32-bytes of output. If the scalar is invalid, an Exception is raised.

class secp256k1.ECDSA

The ECDSA class is intended to be used as a mix in. Its methods can be accessed from any secp256k1.PrivateKey or secp256k1.PublicKey instances.

Methods
  • ecdsa_serialize(raw_sig) -> bytes
    convert the result from ecdsa_sign to DER.

  • ecdsa_deserialie(ser_sig) -> internal object
    convert DER bytes to an internal object.

  • ecdsa_serialize_compact(raw_sig) -> bytes
    convert the result from ecdsa_sign to a compact serialization of 64 bytes.

  • ecdsa_deserialize_compact(ser_sig) -> internal object
    convert a compact serialization of 64 bytes to an internal object.

  • ecdsa_signature_normalize(raw_sig, check_only=False) -> (bool, internal object | None)
    check and optionally convert a signature to a normalized lower-S form. If check_only is True then the normalized signature is not returned.

    This function always return a tuple containing a boolean (True if not previously normalized or False if signature was already normalized), and the normalized signature. When check_only is True, the normalized signature returned is always None.

  • ecdsa_recover(msg, recover_sig, raw=False, digest=hashlib.sha256) -> internal object
    recover an ECDSA public key from a signature generated by ecdsa_sign_recoverable. recover_sig is expected to be an object returned from ecdsa_sign_recoverable (or if it was serialized using ecdsa_recoverable_serialize, then first run it through ecdsa_recoverable_deserialize). msg, raw, and digest are used as described in ecdsa_sign.

    In order to call ecdsa_recover from a PublicKey instance, it's necessary to create the instance by settings flags to ALL_FLAGS: secp256k1.PublicKey(..., flags=secp256k1.ALL_FLAGS).

  • ecdsa_recoverable_serialize(recover_sig) -> (bytes, int)
    convert the result from ecdsa_sign_recoverable to a tuple composed of 65 bytesand an integer denominated as recovery id.

  • ecdsa_recoverable_deserialize(ser_sig, rec_id)-> internal object
    convert the result from ecdsa_recoverable_serialize back to an internal object that can be used by ecdsa_recover.

  • ecdsa_recoverable_convert(recover_sig) -> internal object
    convert a recoverable signature to a normal signature, i.e. one that can be used by ecdsa_serialize and related methods.

Constants

secp256k1.FLAG_SIGN
secp256k1.FLAG_VERIFY
secp256k1.ALL_FLAGS

ALL_FLAGS combines FLAG_SIGN and FLAG_VERIFY using bitwise OR.

These flags are used during context creation (undocumented here) and affect which parts of the context are initialized in the C library. In these bindings, some calls are disabled depending on the active flags but this should not be noticeable unless you are manually specifying flags.

Example

from secp256k1 import PrivateKey, PublicKey

privkey = PrivateKey()
privkey_der = privkey.serialize()
assert privkey.deserialize(privkey_der) == privkey.private_key

sig = privkey.ecdsa_sign(b'hello')
verified = privkey.pubkey.ecdsa_verify(b'hello', sig)
assert verified

sig_der = privkey.ecdsa_serialize(sig)
sig2 = privkey.ecdsa_deserialize(sig_der)
vrf2 = privkey.pubkey.ecdsa_verify(b'hello', sig2)
assert vrf2

pubkey = privkey.pubkey
pub = pubkey.serialize()

pubkey2 = PublicKey(pub, raw=True)
assert pubkey2.serialize() == pub
assert pubkey2.ecdsa_verify(b'hello', sig)
from secp256k1 import PrivateKey

key = '31a84594060e103f5a63eb742bd46cf5f5900d8406e2726dedfc61c7cf43ebad'
msg = '9e5755ec2f328cc8635a55415d0e9a09c2b6f2c9b0343c945fbbfe08247a4cbe'
sig = '30440220132382ca59240c2e14ee7ff61d90fc63276325f4cbe8169fc53ade4a407c2fc802204d86fbe3bde6975dd5a91fdc95ad6544dcdf0dab206f02224ce7e2b151bd82ab'

privkey = PrivateKey(bytes(bytearray.fromhex(key)), raw=True)
sig_check = privkey.ecdsa_sign(bytes(bytearray.fromhex(msg)), raw=True)
sig_ser = privkey.ecdsa_serialize(sig_check)

assert sig_ser == bytes(bytearray.fromhex(sig))
from secp256k1 import PrivateKey

key = '7ccca75d019dbae79ac4266501578684ee64eeb3c9212105f7a3bdc0ddb0f27e'
pub_compressed = '03e9a06e539d6bf5cf1ca5c41b59121fa3df07a338322405a312c67b6349a707e9'
pub_uncompressed = '04e9a06e539d6bf5cf1ca5c41b59121fa3df07a338322405a312c67b6349a707e94c181c5fe89306493dd5677143a329065606740ee58b873e01642228a09ecf9d'

privkey = PrivateKey(bytes(bytearray.fromhex(key)))
pubkey_ser = privkey.pubkey.serialize()
pubkey_ser_uncompressed = privkey.pubkey.serialize(compressed=False)

assert pubkey_ser == bytes(bytearray.fromhex(pub_compressed))
assert pubkey_ser_uncompressed == bytes(bytearray.fromhex(pub_uncompressed))

Technical details about the bundled libsecp256k1

The bundling of libsecp256k1 is handled by the various setup.py build phases:

  • During 'sdist': If the directory libsecp256k1 doesn't exist in the source directory it is downloaded from the location specified by the LIB_TARBALL_URL constant in setup.py and extracted into a directory called libsecp256k1

    To upgrade to a newer version of the bundled libsecp256k1 source simply delete the libsecp256k1 directory and update the LIB_TARBALL_URL to point to a newer commit.

  • During 'install': To support (future) use of system libsecp256k1, and because of the way the way cffi modules are implemented it is necessary to perform system library detection in the cffi build module _cffi_build/build.py as well as in setup.py. For that reason some utility functions have been moved into a setup_support.py module which is imported from both.

    By default, the bundled source code is used to build a library locally that will be statically linked into the CFFI extension.

    You can set the environment variable SECP_BUNDLED_NO_EXPERIMENTAL to disable all experimental modules except the recovery module.

Comments
  • ci: Add cibuildwheel configuration

    ci: Add cibuildwheel configuration

    This cibuildwheel configuration adds precompiled binaries for macos (x86_64, manylinux (i686, x85_64) and musllinux (i686, x86_64) (all versions from cPython 3.6, 3.7, 3.8, 3.9, 3.10) :-)

    opened by cdecker 2
  • setup: Update url in metadata to new repository

    setup: Update url in metadata to new repository

    Update the url in setup metadata to new repository. Hopefully, this will make sure people will report issues to the new repository instead of the old one.

    opened by laanwj 0
  • Update for 0.2.0 release

    Update for 0.2.0 release

    README.md says "The library bundles its own libsecp256k1 currently, as there is no versioning to allow us to safely determine compatibility with an installed library, especially as we also build all the experimental modules."

    But libsecp256k1 now does have versioning as of its 0.2.0 release! Presumably would make sense to update to take advantage of that.

    https://github.com/bitcoin-core/secp256k1/releases/tag/v0.2.0 https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-December/021271.html

    opened by ajtowns 0
  • Recommended way to negate points

    Recommended way to negate points

    I know that the underlying secp256k1 library exposes a pubkey_negate :

    https://github.com/bitcoin-core/secp256k1/blob/6f6cab9989a4d3f4a28e3cdbfacc4e3e1e55c843/include/secp256k1.h#L668

    but at first thought, it's not that surprising that this isn't exposed in this binding, since we have the most fundamental operations: combine (add pubkeys together) and tweak_mul, tweak_add.

    Still, it leaves me a little uncertain what the best way to do -P is. In the now "legacy" compressed encoding we can flip 02/03 starting byte. That feels like an icky way to do it (even if it wasn't the case that we're now tending to use the new Schnorr style 32 byte pubkeys); mathematical operations on keys shouldn't be executed by manipulating their encodings.

    Another obvious thought is: use scalar mult (so tweak_mul) with the value "-1", but that is N-1 where N is the group order and it also feels very bad to be introducing that kind of calculation outside the library/binding.

    Am I missing an obvious way to do it?

    opened by AdamISZ 0
  • Pedersen commitments and range proofs?

    Pedersen commitments and range proofs?

    Based on the README description it seems like this is a maintained version of what previously was

    https://github.com/WTRMQDev/secp256k1-zkp-py

    But the version by Ludvig Broberg did support Pedersen commitments and range proofs. Is it possible to include them or at least provide some recommendation how to access those functionalities in Python?

    Many thanks!

    opened by marekyggdrasil 0
  • pip install failing on M1 OSX Big Sur 11.6

    pip install failing on M1 OSX Big Sur 11.6

    I'm on python 3.8.13 on M1 OSX BigSur,

    when i run

    pip install --no-binary :all: secp256k1

    the following error occurs

    pip install secp256k1
    Collecting secp256k1
      Using cached secp256k1-0.14.0.tar.gz (2.4 MB)
      Preparing metadata (setup.py) ... error
      error: subprocess-exited-with-error
    
      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [53 lines of output]
          0.29.2
          WARNING: The wheel package is not available.
            error: subprocess-exited-with-error
    
            × python setup.py bdist_wheel did not run successfully.
            │ exit code: 1
            ╰─> [10 lines of output]
                WARNING: The wheel package is not available.
                WARNING: The wheel package is not available.
                WARNING: The wheel package is not available.
                WARNING: The wheel package is not available.
                usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
                   or: setup.py --help [cmd1 cmd2 ...]
                   or: setup.py --help-commands
                   or: setup.py cmd --help
    
                error: invalid command 'bdist_wheel'
                [end of output]
    
            note: This error originates from a subprocess, and is likely not a problem with pip.
            ERROR: Failed building wheel for pytest-runner
          ERROR: Failed to build one or more wheels
          Traceback (most recent call last):
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
              subprocess.check_call(cmd)
            File "/Users/bitcarrot/.pyenv/versions/3.8.13/lib/python3.8/subprocess.py", line 364, in check_call
              raise CalledProcessError(retcode, cmd)
          subprocess.CalledProcessError: Command '['/Users/bitcarrot/lngifts/lnbits-legend/env/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/y5/5_y1mtqd4jl_x3yk_5pnm4jr0000gn/T/tmpeiqe9a44', '--quiet', 'pytest-runner==2.6.2']' returned non-zero exit status 1.
    
          The above exception was the direct cause of the following exception:
    
          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/private/var/folders/y5/5_y1mtqd4jl_x3yk_5pnm4jr0000gn/T/pip-install-b2sdfb1b/secp256k1_e343ec56f32d450ca60c1c4f91c5c705/setup.py", line 265, in <module>
              setup(
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/setuptools/__init__.py", line 152, in setup
              _install_setup_requires(attrs)
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
              dist.fetch_build_eggs(dist.setup_requires)
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
              resolved_dists = pkg_resources.working_set.resolve(
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 766, in resolve
              dist = best[req.key] = env.best_match(
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1051, in best_match
              return self.obtain(req, installer)
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1063, in obtain
              return installer(requirement)
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/setuptools/dist.py", line 780, in fetch_build_egg
              return fetch_build_egg(self, req)
            File "/Users/bitcarrot/lngifts/lnbits-legend/env/lib/python3.8/site-packages/setuptools/installer.py", line 77, in fetch_build_egg
              raise DistutilsError(str(e)) from e
          distutils.errors.DistutilsError: Command '['/Users/bitcarrot/lngifts/lnbits-legend/env/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/y5/5_y1mtqd4jl_x3yk_5pnm4jr0000gn/T/tmpeiqe9a44', '--quiet', 'pytest-runner==2.6.2']' returned non-zero exit status 1.
          [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed
    
    × Encountered error while generating package metadata.
    ╰─> See above for output.
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
    
    opened by bitkarrot 2
  • undefined symbol: secp256k1_keypair_xonly_pub

    undefined symbol: secp256k1_keypair_xonly_pub

    Installed the library in a plain new venv running on Arch Linux with Python 3.10, gmp 6.2.1 and libffi 3.4.2 - build seems fine:

    (venv) $ pip install --no-cache-dir secp256k1
    Collecting secp256k1
      Downloading secp256k1-0.14.0.tar.gz (2.4 MB)
         |████████████████████████████████| 2.4 MB 799 kB/s 
    Collecting cffi>=1.3.0
      Downloading cffi-1.15.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (446 kB)
         |████████████████████████████████| 446 kB 7.2 MB/s 
    Collecting pycparser
      Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
         |████████████████████████████████| 118 kB 7.9 MB/s 
    Using legacy 'setup.py install' for secp256k1, since package 'wheel' is not installed.
    Installing collected packages: pycparser, cffi, secp256k1
        Running setup.py install for secp256k1 ... done
    Successfully installed cffi-1.15.0 pycparser-2.21 secp256k1-0.14.0
    

    But on invocation getting this:

    (venv) $ python -m secp256k1 privkey -p
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
        mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
      File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
        return _get_module_details(pkg_main_name, error)
      File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
        __import__(pkg_name)
      File "/tmp/bug/venv/lib/python3.10/site-packages/secp256k1/__init__.py", line 5, in <module>
        from ._libsecp256k1 import ffi, lib
    ImportError: /tmp/bug/venv/lib/python3.10/site-packages/secp256k1/_libsecp256k1.cpython-310-x86_64-linux-gnu.so: undefined symbol: secp256k1_keypair_xonly_pub
    

    Any ideas where the linkage error is coming from?

    opened by yuvadm 0
Owner
Rusty Russell
GPG: 15EE 8D6C AB0E 7F0C F999 BFCB D920 0E6C D1AD B8F1 Rusty Russell
Rusty Russell
The leading native Python SSHv2 protocol library.

Paramiko Paramiko: Python SSH module Copyright: Copyright (c) 2009 Robey Pointer <[email protected]> Copyright: Copyright (c) 2020 Jeff Forcier <

null 8.1k Jan 8, 2023
Python binding to the Networking and Cryptography (NaCl) library

PyNaCl: Python binding to the libsodium library PyNaCl is a Python binding to libsodium, which is a fork of the Networking and Cryptography library. T

Python Cryptographic Authority 941 Jan 4, 2023
cryptography is a package designed to expose cryptographic primitives and recipes to Python developers.

pyca/cryptography cryptography is a package which provides cryptographic recipes and primitives to Python developers. Our goal is for it to be your "c

Python Cryptographic Authority 5.2k Dec 30, 2022
A self-contained cryptographic library for Python

PyCryptodome PyCryptodome is a self-contained Python package of low-level cryptographic primitives. It supports Python 2.7, Python 3.4 and newer, and

Helder Eijs 2.2k Jan 8, 2023
Python ASN.1 library with a focus on performance and a pythonic API

asn1crypto A fast, pure Python library for parsing and serializing ASN.1 structures. Features Why Another Python ASN.1 Library? Related Crypto Librari

Will Bond 282 Dec 11, 2022
Bitcoin Clipper malware made in Python.

a BTC Clipper or a "Bitcoin Clipper" is a type of malware designed to target cryptocurrency transactions.

Nightfall 96 Dec 30, 2022
Freqtrade is a free and open source crypto trading bot written in Python

Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning.

null 20.2k Jan 7, 2023
This python module can analyse cryptocurrency news for any number of coins given and return a sentiment. Can be easily integrated with a Trading bot to keep an eye on the news.

Python script that analyses news headline or body sentiment and returns the overall media sentiment of any given coin. It can take multiple coins an

null 185 Dec 22, 2022
📊Python implementation of the Colin Talks Crypto Bitcoin Bull Run Index (CBBI).

Colin Talks Crypto Bitcoin Bull Run Index (CBBI) This is a Python implementation of the Colin Talks Crypto Bitcoin Bull Run Index (CBBI). It makes use

Kamil Monicz 86 Jan 2, 2023
Learn Blockchains by Building One, A simple Blockchain in Python using Flask as a micro web framework.

Blockchain ✨ Learn Blockchains by Building One Yourself Installation Make sure Python 3.6+ is installed. Install Flask Web Framework. Clone this repos

Vaibhaw 46 Jan 5, 2023
The (Python-based) mining software required for the Nintendo Switch mining project.

ntgbtminer - Nintendo Switch edition This is a version of ntgbtminer that works with the Nintendo Switch bitcoin miner. ntgbtminer ntgbtminer is a no

null 4 Jun 3, 2021
RSI Algorithmic Trading with Python

In this repository you can see my first algorithhmic trading script. I use 5 cryptocurrencies: Bitcoin (BTC), Ethereum (ETH), Bitcoin Cash (BCH), Litecoin (LTC) and Chainlink (LINK).

Jon Aldekoa 4 Mar 16, 2022
A lightweight encryption library in python.

XCrypt About This was initially a project to prove that I could make a strong encryption but I decided to publish it so that the internet peoples coul

Anonymous 8 Sep 10, 2022
A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided

A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided. If you’ve found this bot useful and have profited from it please consider donating any token to my BSC wallet address: 0xE75470B9a7c93038195ca116E342c42F6B3F758b

null 473 Dec 25, 2022
A simple, terminal password manager in Python.

A simple, terminal password manager in Python.

null 81 Nov 22, 2022
Bit is Python's fastest Bitcoin library and was designed from the beginning to feel intuitive, be effortless to use, and have readable source code.

Bit is Python's fastest Bitcoin library and was designed from the beginning to feel intuitive, be effortless to use, and have readable source code.

Ofek Lev 1.1k Jan 2, 2023
Fully configurable automated python script to collect most visted pages based on google dork

Ranked pages collector Fully configurable automated python script to collect most visted pages based on google dork Usage This project is still under

Security Analyzer 9 Sep 10, 2022
Mysterium the first tool which permits you to retrieve the most part of a Python code even the .py or .pyc was extracted from an executable file, even it is encrypted with every existing encryptage. Mysterium don't make any difference between encrypted and non encrypted files, it can retrieve code from Pyarmor or .pyc files.

Mysterium the first tool which permits you to retrieve the most part of a Python code even the .py or .pyc was extracted from an executable file, even it is encrypted with every existing encryptage. Mysterium don't make any difference between encrypted and non encrypted files, it can retrieve code from Pyarmor or .pyc files.

Venax 116 Dec 21, 2022