Skip to main content

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.