Sign Messages and Data
Human Wallet makes it easy to sign messages and data across all supported EVM-compatible blockchains. The SDK abstracts away cryptographic complexity and gas management, while remaining fully compatible with standard Ethereum interfaces.
Overviewβ
- Signing: Sign arbitrary messages and data for authentication, off-chain actions, or user intent verification.
- Multi-Chain Support: Works seamlessly across all supported EVM chains, with automatic chain switching and gas management via the Gas Tank.
Usageβ
All signing methods are available via the SilkProvider
object returned by initSilk()
from the @silk-wallet/silk-wallet-sdk
package.
import { initSilk } from "@silk-wallet/silk-wallet-sdk";
initSilk();
Message Signingβ
personal_sign
β
Sign an arbitrary message with the userβs Human Wallet key. This is useful for authentication, off-chain actions, or verifying user intent.
// message example
const message = 'Hello World!';
const signature = await window.silk.request({
method: "personal_sign",
params: [message, address],
});
- message: The string message to sign.
- address: The userβs EVM address.
Note: The signature is EIP-191 compliant and can be verified using standard Ethereum libraries.
π Demo
Advanced: Typed Data Signingβ
eth_signTypedData_v4
β
Sign EIP-712 typed data (structured data) for advanced use cases like DeFi, DAOs, and more.
// typedData example
const typedData = {
types: {
EIP712Domain: [
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' }
],
Message: [
{ name: 'content', type: 'string' },
{ name: 'timestamp', type: 'uint256' }
]
},
primaryType: 'Message',
domain: {
name: 'Human Wallet Demo',
version: '1',
chainId: 1,
verifyingContract: '0x0000000000000000000000000000000000000000'
},
message: {
content: 'Hello World!',
timestamp: Math.floor(Date.now() / 1000)
}
};
const signature = await window.silk.request({
method: "eth_signTypedData_v4",
params: [address, JSON.stringify(typedData)],
});
- address: The userβs address.
- typedData: The EIP-712 typed data object.
π Demo
Security and User Experienceβ
- User Consent: All signing and transaction actions require explicit user approval via the Human Wallet modal.
- No Private Key Exposure: Private keys never leave the secure enclave; all signing is performed in a secure, isolated environment.
- Multi-Chain: The SDK handles chain switching and ensures transactions are sent to the correct network.