Skip to main content

safe-eth-native

Native (Rust) versions of the hot paths of safe-eth-py:

Function Replaces Backed by
ecrecover(message_hash, v, r, s) -> bytes | None eth-keys ecdsa_recover libsecp256k1
p256_verify(message_hash, r, s, public_key_x, public_key_y) -> bool safe_eth.safe.p256.verify RustCrypto p256
keccak256(data) -> bytes pysha3 keccak_256 tiny-keccak
to_checksum_address(value) -> str fast_to_checksum_address
is_checksum_address(value) -> bool fast_is_checksum_address

ecrecover and p256_verify follow the input rules of the EVM ecrecover and P256VERIFY precompiles: v must be 27 or 28, r and s in [1, n - 1], and high s values are accepted. Values out of those ranges return None / False instead of raising; only a wrong type, or a hash that is not 32 bytes for ecrecover, raises. Both release the GIL while they run, and so does keccak256 for inputs of 2048 bytes or more.

The package is not meant to be used directly. Install it with the native extra of safe-eth-py, which uses it when it is installed and falls back to the Python code when it is not:

pip install "safe-eth-py[native]"

Wheels

Platforms: Linux (glibc 2.28+ and musl) x86_64 and aarch64, macOS x86_64 and arm64, and Windows x86_64. For each one:

  • One abi3 wheel for CPython 3.11 and newer, 3.15 included
  • One wheel per free-threaded CPython version, 3.14t and 3.15t, as abi3 wheels do not load on free-threaded builds. The module runs without the GIL: importing it does not enable the GIL again

Other platforms and Python versions build from the sdist, which needs a Rust toolchain and a C compiler.

Development

From the root of the safe-eth-py repository, uv sync --group dev --all-extras --frozen builds the extension and installs it in the safe-eth-py environment, and pytest native/tests runs its tests. uv rebuilds it when a file in src/ changes.

The tests compare every function with reference implementations (eth-keys, eth-utils, pycryptodome, and pysha3 in the safe-eth-py tests) and run the vectors of the Keccak team, Wycheproof, EIP-55, and the test suites of go-ethereum, eth-keys, eth-utils, coincurve and libsecp256k1. See tests/vectors for their sources. CI runs them on every wheel except the musl ones, which are built but not tested.

Releasing

Bump version in Cargo.toml, then push a native-v<version> tag on a commit of main. Push only the tag: a GitHub release would also run the safe-eth-py release workflow, for nothing. The Native extension workflow builds the wheels and the sdist and publishes them to PyPI with trusted publishing. Before the first release, add a trusted publisher (a pending one while the project does not exist) on PyPI for safe-global/safe-eth-py and the native.yml workflow.

Metadata

Release files for safe-eth-native 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for safe-eth-native 0.1.0
File Size Uploaded Provenance Actions
safe_eth_native-0.1.0.tar.gz 11.0 kB Without provenance Details for safe_eth_native-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for safe-eth-native 0.1.0
File Interpreter ABI Platform Actions
safe_eth_native-0.1.0-cp315-cp315t-manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 free-threading Linux glibc 2.28+ x86-64 Details for safe_eth_native-0.1.0-cp315-cp315t-manylinux_2_28_x86_64.whl
safe_eth_native-0.1.0-cp314-cp314t-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Details for safe_eth_native-0.1.0-cp314-cp314t-manylinux_2_28_x86_64.whl
safe_eth_native-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for safe_eth_native-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl

Total release size: 4.3 MB

Release files / safe_eth_native-0.1.0.tar.gz

Download URL safe_eth_native-0.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2d9e2b91ac6639c0937568221bc786977fff6430525709d744b4f5431db9e244
BLAKE2b-256 checksum
How to use checksums
a30e864dc4c7858cc51788206b57f9d5bf3a3b1745cefda861da7be8b975ab2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / safe_eth_native-0.1.0-cp315-cp315t-manylinux_2_28_x86_64.whl

Download URL safe_eth_native-0.1.0-cp315-cp315t-manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.15 CPython 3.15 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
58e9cf8387584e35aa9f667257f82ee0d7908ce463fe71eb945be84bacc6bea9
BLAKE2b-256 checksum
How to use checksums
dfefd9f6895d5f317217f468440d2e48ec925d35417aa92d84efed929577226a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / safe_eth_native-0.1.0-cp314-cp314t-manylinux_2_28_x86_64.whl

Download URL safe_eth_native-0.1.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ce278f1d80f308756f7f425ae4a0ca2997c3cfafeb690579f481b3f5b8deb0f1
BLAKE2b-256 checksum
How to use checksums
9723987df9af235a8353933a82d0eb7d27fc51122a7ecfdde012d8231a479308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / safe_eth_native-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL safe_eth_native-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
193deca5b5ae0320c0d9d47e7d01ceb77781808cb77721721742bfd1130fe35b
BLAKE2b-256 checksum
How to use checksums
ef1df81f096a117bac54cced24ed89f6317599fbc3bd6bbdaf224782167fca2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for safe-eth-native 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page