Distributed Signature Generation

The full signing example is here.

Let's create NetworkSigner for signing. Note the EphAuth is used to avoid user interaction when generating the signatures.

const authModule = new EphAuth(accountsFromBrowserWallet[0], ephSK!);
// Create a new signer instance
const sdk = new NetworkSigner(wpClient, threshold, partiesNumber, authModule);

Use the NetworkSigner.authenticateAndSign method to generate a signature.

let signMessage = JSON.stringify({
		userOperation: {
			sender: '0x8d4cb2540d993fe34c646299f1ab4af3012ff34c',
			nonce: '0x7',
			initCode: '',
			callData:
				'0000189a...',
			callGasLimit: '123130',
			verificationGasLimit: '153427',
			preVerificationGas: '66768',
			maxFeePerGas: '',
			maxPriorityFeePerGas: '',
			paymasterAndData: ''
		},
		entryPointVersion: 'v0.6.0',
		entryPointAddress: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
		chainId: 80002
	});

let resp = await sdk.authenticateAndSign(selectedKeyId, signMessage);

The SignResponse contains the signature sign and the recovery ID recid.

Note that the network expects the sign request in the exact format as specified above. The network expects a user operation, the entry point version, the entry point address and the chainID - without any of which the network will return an error.

Last updated