This interface is for raw signing over a hash, which primarily applies to Coinbase Smart Wallet integrations and other scenarios requiring basic curve-level signing. For most use cases, such as authenticating to a website or proving ownership, we recommend signing a message.

Use the secp256k1Sign method on the Ethereum client to sign a raw hash along the secp256k1 curve.

secp256k1Sign: async ({walletId: string, hash: string}) => Promise<{signature: string, encoding: 'hex'}>

Usage

const {signature, encoding} = await privy.walletApi.ethereum.secp256k1Sign({
  walletId: 'insert-wallet-id',
  hash: '0x6503b027a625549f7be691646404f275f149d17a119a6804b855bac3030037aa'
});

Parameters

walletId
string
required

Unique ID of the wallet to take actions with.

hash
hash
required

The hash to sign. Must start with ‘0x’.

Returns

signature
string

An encoded string serializing the signature produced by the user’s wallet.

encoding
'hex'

The encoding format for the returned signature. Currently, only 'hex' is supported for Ethereum.