@tevm/voltaire / crypto/Secp256k1
crypto/Secp256k1
Classes
InvalidPrivateKeyError
Defined in: src/crypto/Secp256k1/errors.js:71 Error for invalid private keysSee
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Extends
Constructors
Constructor
new InvalidPrivateKeyError(Defined in: src/crypto/Secp256k1/errors.js:72message):InvalidPrivateKeyError
Parameters
message
any
Returns
InvalidPrivateKeyError
Overrides
Secp256k1Error.constructor
Properties
name
name: string
Defined in: src/crypto/Secp256k1/errors.js:74
Inherited from
Secp256k1Error.name
InvalidPublicKeyError
Defined in: src/crypto/Secp256k1/errors.js:52 Error for invalid public keysSee
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Extends
Constructors
Constructor
new InvalidPublicKeyError(Defined in: src/crypto/Secp256k1/errors.js:53message):InvalidPublicKeyError
Parameters
message
any
Returns
InvalidPublicKeyError
Overrides
Secp256k1Error.constructor
Properties
name
name: string
Defined in: src/crypto/Secp256k1/errors.js:55
Inherited from
Secp256k1Error.name
InvalidSignatureError
Defined in: src/crypto/Secp256k1/errors.js:33 Error for invalid signaturesSee
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Extends
Constructors
Constructor
new InvalidSignatureError(Defined in: src/crypto/Secp256k1/errors.js:34message):InvalidSignatureError
Parameters
message
any
Returns
InvalidSignatureError
Overrides
Secp256k1Error.constructor
Properties
name
name: string
Defined in: src/crypto/Secp256k1/errors.js:36
Inherited from
Secp256k1Error.name
Secp256k1Error
Defined in: src/crypto/Secp256k1/errors.js:14 Base error for secp256k1 operationsSee
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Extends
Error
Extended by
Constructors
Constructor
new Secp256k1Error(Defined in: src/crypto/Secp256k1/errors.js:15message):Secp256k1Error
Parameters
message
any
Returns
Secp256k1Error
Overrides
Error.constructor
Properties
name
name: string
Defined in: src/crypto/Secp256k1/errors.js:17
Inherited from
Error.name
Interfaces
Secp256k1SignatureType
Defined in: src/crypto/Secp256k1/SignatureType.ts:22 ECDSA signature with Ethereum-compatible v value Components:- r: x-coordinate of the ephemeral public key (32 bytes, HashType)
- s: signature proof value (32 bytes, HashType)
- v: recovery id (27 or 28 for Ethereum)
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Example
Properties
r
r: HashType
Defined in: src/crypto/Secp256k1/SignatureType.ts:23
s
s: HashType
Defined in: src/crypto/Secp256k1/SignatureType.ts:24
v
v: number
Defined in: src/crypto/Secp256k1/SignatureType.ts:25
Type Aliases
BrandedSignature
BrandedSignature = Secp256k1SignatureType
Defined in: src/crypto/Secp256k1/SignatureType.ts:31
Deprecated
Use Secp256k1SignatureType insteadSecp256k1PublicKeyType
Secp256k1PublicKeyType =Defined in: src/crypto/Secp256k1/Secp256k1PublicKeyType.ts:11 Branded secp256k1 public key type - 64 byte uncompressed public key Format: x-coordinate (32 bytes) || y-coordinate (32 bytes)Uint8Array&object
Type Declaration
[brand]
readonly[brand]:"Secp256k1PublicKey"
length
readonlylength:64
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Variables
CURVE_ORDER
Defined in: src/crypto/Secp256k1/constants.js:14 secp256k1 curve order (number of points on the curve)constCURVE_ORDER:115792089237316195423570985008687907852837564279074904382605163141518161494337n=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
PRIVATE_KEY_SIZE
Defined in: src/crypto/Secp256k1/constants.js:29 Private key size in bytesconstPRIVATE_KEY_SIZE:32=32
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
PrivateKey
Defined in: src/crypto/Secp256k1/Secp256k1.js:54constPrivateKey:__module=PrivateKeyMethods
PUBLIC_KEY_SIZE
Defined in: src/crypto/Secp256k1/constants.js:43 Uncompressed public key size in bytes (64 bytes, no prefix)constPUBLIC_KEY_SIZE:64=64
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
PublicKey
Defined in: src/crypto/Secp256k1/Secp256k1.js:53constPublicKey:__module=PublicKeyMethods
Secp256k1
Defined in: src/crypto/Secp256k1/Secp256k1.js:93 secp256k1/ECDSA Cryptography namespace Complete ECDSA signing and verification using the secp256k1 elliptic curve. All operations use the audited @noble/curves library for security. Full Ethereum compatibility with v = 27/28 recovery IDs.constSecp256k1:object
Type Declaration
addPoints()
addPoints: (Add two secp256k1 public key points Performs elliptic curve point addition: P1 + P2. Used in ERC-5564 stealth address generation.pubKey1,pubKey2) =>Secp256k1PublicKeyType
Parameters
pubKey1
Secp256k1PublicKeyType
First 64-byte uncompressed public key
pubKey2
Secp256k1PublicKeyType
Second 64-byte uncompressed public key
Returns
Secp256k1PublicKeyType
Result 64-byte uncompressed public key
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If either public key is invalidThrows
If point addition failsExample
createKeyPair()
createKeyPair: () => object
Generate a new secp256k1 key pair
Returns
object
Key pair with 32-byte private key and 65-byte uncompressed public key
privateKey
privateKey: Uint8Array
publicKey
publicKey: Uint8Array
Example
CURVE_ORDER
CURVE_ORDER: bigint
secp256k1 curve order (number of points on the curve)
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
derivePublicKey()
derivePublicKey: (Derive public key from private key Computes the public key point from a private key using scalar multiplication on the secp256k1 curve.privateKey) =>Secp256k1PublicKeyType
Parameters
privateKey
PrivateKeyType
32-byte private key
Returns
Secp256k1PublicKeyType
64-byte uncompressed public key
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If private key is invalidExample
ecdh()
ecdh: (Perform ECDH key exchange Computes shared secret from your private key and their public key. Returns the x-coordinate of the shared point (32 bytes).privateKey,publicKey) =>Uint8Array<ArrayBufferLike>
Parameters
privateKey
PrivateKeyType
Your 32-byte private key
publicKey
Secp256k1PublicKeyType
Their 64-byte uncompressed public key
Returns
Uint8Array<ArrayBufferLike>
32-byte shared secret (x-coordinate)
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If private key is invalidThrows
If public key is invalidThrows
If ECDH computation failsExample
getSharedSecret()
getSharedSecret: (Perform ECDH key exchange Computes shared secret from your private key and their public key. Returns the x-coordinate of the shared point (32 bytes).privateKey,publicKey) =>Uint8Array<ArrayBufferLike> =ecdh
Parameters
privateKey
PrivateKeyType
Your 32-byte private key
publicKey
Secp256k1PublicKeyType
Their 64-byte uncompressed public key
Returns
Uint8Array<ArrayBufferLike>
32-byte shared secret (x-coordinate)
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If private key is invalidThrows
If public key is invalidThrows
If ECDH computation failsExample
isValidPrivateKey()
isValidPrivateKey: (Validate private key Checks that the private key is within valid range [1, n-1] where n is the curve order.privateKey) =>boolean
Parameters
privateKey
Uint8Array<ArrayBufferLike>
32-byte private key
Returns
boolean
true if private key is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
isValidPublicKey()
isValidPublicKey: (Validate public key Checks that the public key is a valid point on the secp256k1 curve.publicKey) =>publicKey is Secp256k1PublicKeyType
Parameters
publicKey
Uint8Array<ArrayBufferLike>
64-byte uncompressed public key
Returns
publicKey is Secp256k1PublicKeyType
true if public key is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
isValidSignature()
isValidSignature: (Validate signature components Checks that r and s are within valid range [1, n-1] where n is the curve order. Also enforces low-s values to prevent malleability.signature) =>boolean
Parameters
signature
Secp256k1SignatureType
ECDSA signature to validate (r and s are HashType)
Returns
boolean
true if signature is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
PRIVATE_KEY_SIZE
PRIVATE_KEY_SIZE: number
Private key size in bytes
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
PrivateKey
PrivateKey:__module=PrivateKeyMethods
PUBLIC_KEY_SIZE
PUBLIC_KEY_SIZE: number
Uncompressed public key size in bytes (64 bytes, no prefix)
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
PublicKey
PublicKey:__module=PublicKeyMethods
randomPrivateKey()
randomPrivateKey: () =>Generate a cryptographically secure random secp256k1 private keyUint8Array<ArrayBufferLike>
Returns
Uint8Array<ArrayBufferLike>
32-byte private key
Example
recoverPublicKey()
recoverPublicKey: (Recover public key from signature and message hash Uses the recovery id (v) to recover the exact public key that created the signature. This is what enables Ethereum’s address recovery from transaction signatures.signature,messageHash) =>Secp256k1PublicKeyType
Parameters
signature
ECDSA signature componentsr
Uint8Array<ArrayBufferLike>
32-byte signature component r
s
Uint8Array<ArrayBufferLike>
32-byte signature component s
v
number
Recovery id (27/28 or 0/1)
messageHash
HashType
32-byte message hash that was signed
Returns
Secp256k1PublicKeyType
64-byte uncompressed public key
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If signature or recovery failsExample
recoverPublicKeyFromHash()
recoverPublicKeyFromHash: (Recover public key from signature and pre-hashed message This is the hash-level API that operates directly on a 32-byte hash. Use this when you need custom hashing schemes or interop with other libraries. For standard Ethereum signing, use recoverPublicKey() instead. Uses the recovery id (v) to recover the exact public key that created the signature. This is what enables Ethereum’s address recovery from transaction signatures.signature,hash) =>Secp256k1PublicKeyType
Parameters
signature
ECDSA signature componentsr
Uint8Array<ArrayBufferLike>
32-byte signature component r
s
Uint8Array<ArrayBufferLike>
32-byte signature component s
v
number
Recovery id (27/28 or 0/1)
hash
HashType
32-byte hash that was signed (pre-hashed message)
Returns
Secp256k1PublicKeyType
64-byte uncompressed public key
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If signature or recovery failsThrows
If hash is not 32 bytesExample
scalarMultiply()
scalarMultiply: (Multiply generator point by scalar Performs scalar multiplication: scalar * G (generator point). Used in ERC-5564 stealth address generation.scalar) =>Secp256k1PublicKeyType
Parameters
scalar
Uint8Array<ArrayBufferLike>
32-byte scalar value
Returns
Secp256k1PublicKeyType
Result 64-byte uncompressed public key
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If scalar multiplication failsExample
sign()
sign: (Sign a message hash with a private key Uses deterministic ECDSA (RFC 6979) for signature generation. Returns signature with Ethereum-compatible v value (27 or 28).messageHash,privateKey) =>Secp256k1SignatureType
Parameters
messageHash
HashType
32-byte message hash to sign
privateKey
PrivateKeyType
32-byte private key
Returns
Secp256k1SignatureType
ECDSA signature with r, s, v components
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If private key is invalidThrows
If signing failsExample
Signature
Signature:__module=SignatureMethods
SIGNATURE_COMPONENT_SIZE
SIGNATURE_COMPONENT_SIZE: number
Signature component size in bytes (r and s are each 32 bytes)
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
signHash()
signHash: (Sign a pre-hashed message with a private key This is the hash-level API that operates directly on a 32-byte hash. Use this when you need custom hashing schemes or interop with other libraries. For standard Ethereum signing, use sign() instead. Uses deterministic ECDSA (RFC 6979) for signature generation. Returns signature with Ethereum-compatible v value (27 or 28).hash,privateKey) =>Secp256k1SignatureType
Parameters
hash
HashType
32-byte hash to sign (pre-hashed message)
privateKey
PrivateKeyType
32-byte private key
Returns
Secp256k1SignatureType
ECDSA signature with r, s, v components
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If private key is invalidThrows
If signing fails or hash is not 32 bytesExample
verify()
verify: (Verify an ECDSA signaturesignature,messageHash,publicKey) =>boolean
Parameters
signature
Secp256k1SignatureType
ECDSA signature with r, s, v components (r and s are HashType)
messageHash
HashType
32-byte message hash that was signed
publicKey
Secp256k1PublicKeyType
64-byte uncompressed public key
Returns
boolean
true if signature is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If signature v is invalidExample
verifyHash()
verifyHash: (Verify an ECDSA signature against a pre-hashed message This is the hash-level API that operates directly on a 32-byte hash. Use this when you need custom hashing schemes or interop with other libraries. For standard Ethereum signing, use verify() instead.signature,hash,publicKey) =>boolean
Parameters
signature
Secp256k1SignatureType
ECDSA signature with r, s, v components (r and s are HashType)
hash
HashType
32-byte hash that was signed (pre-hashed message)
publicKey
Secp256k1PublicKeyType
64-byte uncompressed public key
Returns
boolean
true if signature is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If hash is not 32 bytesExample
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Signature
Defined in: src/crypto/Secp256k1/Secp256k1.js:52constSignature:__module=SignatureMethods
SIGNATURE_COMPONENT_SIZE
Defined in: src/crypto/Secp256k1/constants.js:57 Signature component size in bytes (r and s are each 32 bytes)constSIGNATURE_COMPONENT_SIZE:32=32
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
Functions
addPoints()
addPoints(Defined in: src/crypto/Secp256k1/addPoints.js:29 Add two secp256k1 public key points Performs elliptic curve point addition: P1 + P2. Used in ERC-5564 stealth address generation.pubKey1,pubKey2):Secp256k1PublicKeyType
Parameters
pubKey1
Secp256k1PublicKeyType
First 64-byte uncompressed public key
pubKey2
Secp256k1PublicKeyType
Second 64-byte uncompressed public key
Returns
Secp256k1PublicKeyType
Result 64-byte uncompressed public key
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If either public key is invalidThrows
If point addition failsExample
createKeyPair()
createKeyPair(): object
Defined in: src/crypto/Secp256k1/createKeyPair.js:15
Generate a new secp256k1 key pair
Returns
object
Key pair with 32-byte private key and 65-byte uncompressed public key
privateKey
privateKey: Uint8Array
publicKey
publicKey: Uint8Array
Example
derivePublicKey()
derivePublicKey(Defined in: src/crypto/Secp256k1/derivePublicKey.js:25 Derive public key from private key Computes the public key point from a private key using scalar multiplication on the secp256k1 curve.privateKey):Secp256k1PublicKeyType
Parameters
privateKey
PrivateKeyType
32-byte private key
Returns
Secp256k1PublicKeyType
64-byte uncompressed public key
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If private key is invalidExample
ecdh()
ecdh(Defined in: src/crypto/Secp256k1/ecdh.js:34 Perform ECDH key exchange Computes shared secret from your private key and their public key. Returns the x-coordinate of the shared point (32 bytes).privateKey,publicKey):Uint8Array<ArrayBufferLike>
Parameters
privateKey
PrivateKeyType
Your 32-byte private key
publicKey
Secp256k1PublicKeyType
Their 64-byte uncompressed public key
Returns
Uint8Array<ArrayBufferLike>
32-byte shared secret (x-coordinate)
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If private key is invalidThrows
If public key is invalidThrows
If ECDH computation failsExample
getSharedSecret()
getSharedSecret(Defined in: src/crypto/Secp256k1/ecdh.js:34 Perform ECDH key exchange Computes shared secret from your private key and their public key. Returns the x-coordinate of the shared point (32 bytes).privateKey,publicKey):Uint8Array<ArrayBufferLike>
Parameters
privateKey
PrivateKeyType
Your 32-byte private key
publicKey
Secp256k1PublicKeyType
Their 64-byte uncompressed public key
Returns
Uint8Array<ArrayBufferLike>
32-byte shared secret (x-coordinate)
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If private key is invalidThrows
If public key is invalidThrows
If ECDH computation failsExample
isValidPrivateKey()
isValidPrivateKey(Defined in: src/crypto/Secp256k1/isValidPrivateKey.js:38 Validate private key Checks that the private key is within valid range [1, n-1] where n is the curve order.privateKey):boolean
Parameters
privateKey
Uint8Array<ArrayBufferLike>
32-byte private key
Returns
boolean
true if private key is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
isValidPublicKey()
isValidPublicKey(Defined in: src/crypto/Secp256k1/isValidPublicKey.js:24 Validate public key Checks that the public key is a valid point on the secp256k1 curve.publicKey):publicKey is Secp256k1PublicKeyType
Parameters
publicKey
Uint8Array<ArrayBufferLike>
64-byte uncompressed public key
Returns
publicKey is Secp256k1PublicKeyType
true if public key is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
isValidSignature()
isValidSignature(Defined in: src/crypto/Secp256k1/isValidSignature.js:39 Validate signature components Checks that r and s are within valid range [1, n-1] where n is the curve order. Also enforces low-s values to prevent malleability.signature):boolean
Parameters
signature
Secp256k1SignatureType
ECDSA signature to validate (r and s are HashType)
Returns
boolean
true if signature is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
Example
randomPrivateKey()
randomPrivateKey():Defined in: src/crypto/Secp256k1/randomPrivateKey.js:16 Generate a cryptographically secure random secp256k1 private keyUint8Array<ArrayBufferLike>
Returns
Uint8Array<ArrayBufferLike>
32-byte private key
Example
recoverPublicKey()
recoverPublicKey(Defined in: src/crypto/Secp256k1/recoverPublicKey.js:49 Recover public key from signature and message hash Uses the recovery id (v) to recover the exact public key that created the signature. This is what enables Ethereum’s address recovery from transaction signatures.signature,messageHash):Secp256k1PublicKeyType
Parameters
signature
ECDSA signature componentsr
Uint8Array<ArrayBufferLike>
32-byte signature component r
s
Uint8Array<ArrayBufferLike>
32-byte signature component s
v
number
Recovery id (27/28 or 0/1)
messageHash
HashType
32-byte message hash that was signed
Returns
Secp256k1PublicKeyType
64-byte uncompressed public key
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If signature or recovery failsExample
recoverPublicKeyFromHash()
recoverPublicKeyFromHash(Defined in: src/crypto/Secp256k1/recoverPublicKeyFromHash.js:64 Recover public key from signature and pre-hashed message This is the hash-level API that operates directly on a 32-byte hash. Use this when you need custom hashing schemes or interop with other libraries. For standard Ethereum signing, use recoverPublicKey() instead. Uses the recovery id (v) to recover the exact public key that created the signature. This is what enables Ethereum’s address recovery from transaction signatures.signature,hash):Secp256k1PublicKeyType
Parameters
signature
ECDSA signature componentsr
Uint8Array<ArrayBufferLike>
32-byte signature component r
s
Uint8Array<ArrayBufferLike>
32-byte signature component s
v
number
Recovery id (27/28 or 0/1)
hash
HashType
32-byte hash that was signed (pre-hashed message)
Returns
Secp256k1PublicKeyType
64-byte uncompressed public key
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If signature or recovery failsThrows
If hash is not 32 bytesExample
scalarMultiply()
scalarMultiply(Defined in: src/crypto/Secp256k1/scalarMultiply.js:26 Multiply generator point by scalar Performs scalar multiplication: scalar * G (generator point). Used in ERC-5564 stealth address generation.scalar):Secp256k1PublicKeyType
Parameters
scalar
Uint8Array<ArrayBufferLike>
32-byte scalar value
Returns
Secp256k1PublicKeyType
Result 64-byte uncompressed public key
See
- https://voltaire.tevm.sh/crypto for crypto documentation
- https://eips.ethereum.org/EIPS/eip-5564 for ERC-5564 stealth addresses
Since
0.0.0Throws
If scalar multiplication failsExample
sign()
sign(Defined in: src/crypto/Secp256k1/sign.js:32 Sign a message hash with a private key Uses deterministic ECDSA (RFC 6979) for signature generation. Returns signature with Ethereum-compatible v value (27 or 28).messageHash,privateKey):Secp256k1SignatureType
Parameters
messageHash
HashType
32-byte message hash to sign
privateKey
PrivateKeyType
32-byte private key
Returns
Secp256k1SignatureType
ECDSA signature with r, s, v components
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If private key is invalidThrows
If signing failsExample
signHash()
signHash(Defined in: src/crypto/Secp256k1/signHash.js:41 Sign a pre-hashed message with a private key This is the hash-level API that operates directly on a 32-byte hash. Use this when you need custom hashing schemes or interop with other libraries. For standard Ethereum signing, use sign() instead. Uses deterministic ECDSA (RFC 6979) for signature generation. Returns signature with Ethereum-compatible v value (27 or 28).hash,privateKey):Secp256k1SignatureType
Parameters
hash
HashType
32-byte hash to sign (pre-hashed message)
privateKey
PrivateKeyType
32-byte private key
Returns
Secp256k1SignatureType
ECDSA signature with r, s, v components
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If private key is invalidThrows
If signing fails or hash is not 32 bytesExample
verify()
verify(Defined in: src/crypto/Secp256k1/verify.js:41 Verify an ECDSA signaturesignature,messageHash,publicKey):boolean
Parameters
signature
Secp256k1SignatureType
ECDSA signature with r, s, v components (r and s are HashType)
messageHash
HashType
32-byte message hash that was signed
publicKey
Secp256k1PublicKeyType
64-byte uncompressed public key
Returns
boolean
true if signature is valid, false otherwise
See
https://voltaire.tevm.sh/crypto for crypto documentationSince
0.0.0Throws
If signature v is invalidExample
verifyHash()
verifyHash(Defined in: src/crypto/Secp256k1/verifyHash.js:49 Verify an ECDSA signature against a pre-hashed message This is the hash-level API that operates directly on a 32-byte hash. Use this when you need custom hashing schemes or interop with other libraries. For standard Ethereum signing, use verify() instead.signature,hash,publicKey):boolean
Parameters
signature
Secp256k1SignatureType
ECDSA signature with r, s, v components (r and s are HashType)
hash
HashType
32-byte hash that was signed (pre-hashed message)
publicKey
Secp256k1PublicKeyType
64-byte uncompressed public key
Returns
boolean
true if signature is valid, false otherwise

