secp256k1_sign
On-chain secp256k1 ECDSA signing
Sign a message with the secp256k1 signing precompile at 0x69.
Overview
secp256k1_sign() and async_secp256k1_sign():
hash the input
messagewith an EIP-191 personal-sign prefixsign the hash using the provided private key
return signature bytes (
HexBytes)
Signature
def secp256k1_sign(
w3: Web3,
*,
sk: PrivateKey,
message: str,
) -> HexBytes
async def async_secp256k1_sign(
w3: AsyncWeb3,
*,
sk: PrivateKey,
message: str,
) -> HexBytesParameters
Parameter
Type
Required
Description
w3
Web3 / AsyncWeb3
Yes
Connected Seismic client
message
str
Yes
Message text to sign
Returns
Type
Description
HexBytes
Signature bytes (r/s plus recovery byte)
Examples
Basic Usage
Verify Off-Chain
Async Usage
Read Signature Components
Hashing Behavior
The SDK hashes with:
Gas Cost
Fixed cost: 3000.
Notes
messageis UTF-8 encoded before hashing/signing.Keep private keys out of logs and telemetry.
The output format is suitable for typical Ethereum signature verification flows.
See Also
Last updated

