For chains supported at the Tier 2 level , you can invoke Privy’s raw sign functionality to sign over a hash, e.g. the hash of a transaction. You can then use the returned signature to submit and send your transaction.
For examples of how to use raw sign for a specific chain, see this recipe .
Sign a raw hash along the blockchain’s cryptographic curve using the wallet’s private key. Make a POST
request to
https://api.privy.io/v1/wallets/ {wallet_id} /raw_sign
Usage curl --request POST \
--url https://api.privy.io/v1/wallets/{wallet_id}/raw_sign \
--header 'Authorization: Basic Y20xNWh4eDUyMDVlNWx2NHVkdmE3enBqejoybWhVOWhhVTFQYjhYNXV1cVdxQVRIdW5xTWIyUlBKRm5GSHRzWDVzbXNkdUJRUDZtTW05YldmalBwS3hocjJQZHNHY0Q5NkFUeDc5em03WWhicUZLWkM4' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '{
"params": {
"hash": "0x0775aeed9c9ce6e0fbc4db25c5e4e6368029651c905c286f813126a09025a21e"
}
}'
A successful response will look like:
{
"data" : {
"signature" : "0x0775aeed9c9ce6e0fbc4db25c5e4e6368029651c905c286f813126a09025a21e" ,
"encoding" : "hex"
}
}
Authorization App secret authentication.
privy-authorization-signature
Request authorization signature. If multiple signatures are required, they should be comma
separated.
Path Body The hex-encoded hash to sign, prefixed with 0x
.
Response The signature, prefixed with 0x
.
The encoding of the signature.
Sign a raw hash along the blockchain’s cryptographic curve using the wallet’s private key. Make a POST
request to
https://api.privy.io/v1/wallets/ {wallet_id} /raw_sign
Usage curl --request POST \
--url https://api.privy.io/v1/wallets/{wallet_id}/raw_sign \
--header 'Authorization: Basic Y20xNWh4eDUyMDVlNWx2NHVkdmE3enBqejoybWhVOWhhVTFQYjhYNXV1cVdxQVRIdW5xTWIyUlBKRm5GSHRzWDVzbXNkdUJRUDZtTW05YldmalBwS3hocjJQZHNHY0Q5NkFUeDc5em03WWhicUZLWkM4' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '{
"params": {
"hash": "0x0775aeed9c9ce6e0fbc4db25c5e4e6368029651c905c286f813126a09025a21e"
}
}'
A successful response will look like:
{
"data" : {
"signature" : "0x0775aeed9c9ce6e0fbc4db25c5e4e6368029651c905c286f813126a09025a21e" ,
"encoding" : "hex"
}
}
Authorization App secret authentication.
privy-authorization-signature
Request authorization signature. If multiple signatures are required, they should be comma
separated.
Path Body The hex-encoded hash to sign, prefixed with 0x
.
Response The signature, prefixed with 0x
.
The encoding of the signature.
Sign a raw hash along the blockchain’s cryptographic curve using the wallet’s private key.
signRawHash : ({ address : string , chainType : CurveSigningChainType , hash : HexString }) =>
Promise < { signature : HexString } > ;
Usage import { useSignRawHash } from '@privy-io/react-auth/extended-chains' ;
const { signRawHash } = useSignRawHash ();
const { signature } = await signRawHash ({
address: 'insert-wallet-address' ,
chainType: 'cosmos' , // or 'stellar', 'sui', etc.
hash: '0x1acab030f479bda7829de07e9db4138cec5d38574df17d65af1617b7268541c0'
});
console . log ( signature );
// 0x4d349c0c04abec47f2af0929b6dd5abcef2f29cb90b596772af928b3ef6e34316108eab1c47fac6d1d5ec51da59bd9124a80c4d353e130a8e675a3ad952e4c46
Parameters The address of the wallet to use for signing the raw hash.
opts.chainType
CurveSigningChainType
required
The chain type of the wallet to use for signing the raw hash.
The raw hash to sign over, hex-encoded and prefixed with 0x
.
Returns The signature produced by the wallet. Hex-encoded and prefixed with 0x
.