Cargo Features

[dependencies]
secp256k1 = { version = "0.30.0", default-features = false, features = ["std", "alloc", "recovery", "lowmemory", "global-context", "global-context-less-secure", "hashes", "rand", "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? = alloc

Enables std of secp256k1-sys, std of optional bitcoin_hashes ^0.14, std and std_rng of optional rand

Affects context::global

alloc std

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

Enables alloc of secp256k1-sys

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 and std features 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

hashes implicit feature

Enables bitcoin_hashes ^0.14

bitcoin_hashes:

Hash functions used by the rust-bitcoin eccosystem

rand implicit feature

Enables rand

rand:

Random number generators and other randomness functionality

Affects secp256k1::generate_keypair

serde implicit feature

Enables serde

serde:

A generic serialization/deserialization framework