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