EVM Interactions
Sign a message in Ethereum/EVM
In this example, we are creating a button to sign a message and log the signature to the console.
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
const SignMessageButton = () => {
const { primaryWallet } = useDynamicContext();
const signMessage = async () => {
if (!primaryWallet) return;
const signature = await primaryWallet.connector.signMessage('example');
console.log('signature', signature);
};
return <button onClick={signMessage}>Sign message</button>;
};
Was this page helpful?