2021-12-13 12:15:30 -05:00
2021-12-06 13:13:34 -05:00
2021-12-07 10:25:42 -05:00
2021-12-07 10:25:42 -05:00
2021-12-06 13:13:34 -05:00
2021-12-07 10:18:14 -05:00
2021-12-11 19:30:55 -05:00
2021-12-07 10:25:42 -05:00

bdk-python

The Python language bindings for the bitcoindevkit.

See the package on PyPI.

Install the latest release using

pip install bdkpython

Run the tests

python -m tox

Build the package

python -m build

Install locally

pip install ./dist/bdkpython-0.0.1-py3-none-any.whl

Known issues

Note that until the fix is merged upstream in uniffi-rs, the loadIndirect() function in the bdk.py module must be replaced with the following:

def loadIndirect():
    if sys.platform == "linux":
        # libname = "lib{}.so"
        libname = os.path.join(os.path.dirname(__file__), "lib{}.so")
    elif sys.platform == "darwin":
        # libname = "lib{}.dylib"
        libname = os.path.join(os.path.dirname(__file__), "lib{}.dylib")
    elif sys.platform.startswith("win"):
        # As of python3.8, ctypes does not seem to search $PATH when loading DLLs.
        # We could use `os.add_dll_directory` to configure the search path, but
        # it doesn't feel right to mess with application-wide settings. Let's
        # assume that the `.dll` is next to the `.py` file and load by full path.
        libname = os.path.join(
            os.path.dirname(__file__),
            "{}.dll",
        )
    return getattr(ctypes.cdll, libname.format("bdkffi"))

Support both macOS architectures

In order to support both macOS architectures, we must modify the loadIndirect() method a little further:

import platform
def loadIndirect():
    if sys.platform == "linux":
        # libname = "lib{}.so"
        # libname = os.path.join(os.path.dirname(__file__), "lib{}.so")
        libname = os.path.join(os.path.dirname(__file__), "linux-x86_64/lib{}.so")
    elif sys.platform == "darwin":
        # libname = "lib{}.dylib"
        # libname = os.path.join(os.path.dirname(__file__), "lib{}.dylib")
        if platform.machine() == "arm64":
            libname = os.path.join(os.path.dirname(__file__), "darwin-arm64/lib{}.dylib")
        elif platform.machine() == "x86_64":
            libname = os.path.join(os.path.dirname(__file__), "darwin-x86_64/lib{}.dylib")
    elif sys.platform.startswith("win"):
        # As of python3.8, ctypes does not seem to search $PATH when loading DLLs.
        # We could use `os.add_dll_directory` to configure the search path, but
        # it doesn't feel right to mess with application-wide settings. Let's
        # assume that the `.dll` is next to the `.py` file and load by full path.
        libname = os.path.join(
            os.path.dirname(__file__),
            "{}.dll",
        )
    return getattr(ctypes.cdll, libname.format("bdkffi"))
Description
Frost experimentation on bdk-ffi
Readme 22 MiB
Languages
Rust 64.6%
Kotlin 18.1%
Swift 9.5%
Python 4.6%
Shell 2.2%
Other 1%