Quickstart
Concepts
- What is Smart Wallet?
- Features
- Usage Details
- Base Gasless Campaign
Guides
Technical Reference
- Coinbase Wallet SDK
- Coinbase Wallet SDK
- Overview
- eth_accounts
- eth_blockNumber
- eth_chainId
- eth_coinbase
- eth_estimateGas
- eth_feeHistory
- eth_gasPrice
- eth_getBalance
- eth_getBlockByHash
- eth_getBlockByNumber
- eth_getBlockTransactionCountByHash
- eth_getBlockTransactionCountByNumber
- eth_getCode
- eth_getLogs
- eth_getProof
- eth_getStorageAt
- eth_getTransactionByBlockHashAndIndex
- eth_getTransactionByBlockNumberAndIndex
- eth_getTransactionByHash
- eth_getTransactionCount
- eth_getTransactionReceipt
- eth_getUncleCountByBlockHash
- eth_getUncleCountByBlockNumber
- eth_requestAccounts
- eth_sendRawTransaction
- eth_sendTransaction
- eth_signTypedData_v4
- personal_sign
- wallet_addEthereumChain
- wallet_addSubAccount
- wallet_connect
- wallet_switchEthereumChain
- wallet_watchAsset
- web3_clientVersion
- Spend Permissions
- Sub Accounts Reference
- Profiles Reference
eth_signTypedData_v4
Sign structured data according to EIP-712
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_signTypedData_v4",
"params": [
"0x3b7252d007059ffc82d16d022da3cbf9992d2f70",
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"Person": [
{ "name": "name", "type": "string" },
{ "name": "wallet", "type": "address" }
]
},
"primaryType": "Person",
"domain": {
"name": "Example App",
"version": "1",
"chainId": 1,
"verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
},
"message": {
"name": "Alice",
"wallet": "0x3b7252d007059ffc82d16d022da3cbf9992d2f70"
}
}
]
}
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c"
}
Defined in EIP-712
Signs structured data according to EIP-712, which provides a more secure way to sign data by providing context and structure to the data being signed.
Parameters
The address that should sign the data (20 bytes).
The typed structured data to be signed.
An object containing type definitions for the structured data.
The primary type from the types object that will be signed.
The domain separator as defined by EIP-712.
The data object to be signed according to the primary type.
Returns
The signature as a hexadecimal string.
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_signTypedData_v4",
"params": [
"0x3b7252d007059ffc82d16d022da3cbf9992d2f70",
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"Person": [
{ "name": "name", "type": "string" },
{ "name": "wallet", "type": "address" }
]
},
"primaryType": "Person",
"domain": {
"name": "Example App",
"version": "1",
"chainId": 1,
"verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
},
"message": {
"name": "Alice",
"wallet": "0x3b7252d007059ffc82d16d022da3cbf9992d2f70"
}
}
]
}
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c"
}
Error Handling
Code | Message | Description |
---|---|---|
4001 | User rejected the request | User denied the signing request |
4100 | Requested method not supported | The method is not supported by the wallet |
-32602 | Invalid params | Invalid typed data structure |
Always validate the domain and verifying contract address to prevent signature replay attacks.
EIP-712 signatures provide better security than personal_sign by giving users context about what they’re signing.
Was this page helpful?
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_signTypedData_v4",
"params": [
"0x3b7252d007059ffc82d16d022da3cbf9992d2f70",
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"Person": [
{ "name": "name", "type": "string" },
{ "name": "wallet", "type": "address" }
]
},
"primaryType": "Person",
"domain": {
"name": "Example App",
"version": "1",
"chainId": 1,
"verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
},
"message": {
"name": "Alice",
"wallet": "0x3b7252d007059ffc82d16d022da3cbf9992d2f70"
}
}
]
}
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c"
}