Cargo Features

[dependencies]
secp256k1 = { version = "0.29.0", default-features = false, features = ["std", "alloc", "hashes-std", "rand-std", "recovery", "lowmemory", "global-context", "global-context-less-secure", "serde"] }
default = std

The std feature is set by default whenever secp256k1 is added without default-features = false somewhere in the dependency tree.

std default global-context? hashes-std? rand-std? = alloc

Enables std of secp256k1-sys

Affects context::global

alloc std

allow use of Secp256k1::new and related API that requires an allocator

Enables alloc of secp256k1-sys

hashes-std = std

Enables std of bitcoin_hashes

You likely only want to enable these if you explicitly do not want to use "std", otherwise enable the respective -std feature e.g., hashes-std

rand-std = rand, std

Enables std and std_rng of rand

recovery

Enables recovery of secp256k1-sys

lowmemory

Enables lowmemory of secp256k1-sys

global-context global-context-less-secure? = std

Affects context::global, secp256k1::generate_keypair

global-context-less-secure = global-context

disable re-randomization of the global context, which provides some defense-in-depth against sidechannel attacks. You should only use this feature if you expect the rand crate's thread_rng to panic. (If you are sure the rand-std feature will not be enabled, e.g. if you are doing a no-std build, then this feature does nothing and is not necessary.)

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

serde implicit feature

Enables serde

serde:

A generic serialization/deserialization framework

hashes hashes-std?

Enables bitcoin_hashes

rand rand-std?

Affects secp256k1::generate_keypair