Unable to sign a serialized message

Hey all,

I am currently having an issue with signing a serialized message used for a sponsored txn.

I have followed the necessary steps to serialize a message but it won’t sign it. If there were errors in my steps that should hinder the serialization process.

The given message does not have correct format.
at sb.signMessage

  if (serializedMessage !== '') {
      console.log(serializedMessage, 'serializedMessage');

      const promise = ccProvider.signMessage(caccount, {
        type: 'BinaryMessage',
        value: serializedMessage,
        schema: typeSchemaFromBase64(SERIALIZATION_HELPER_SCHEMA),

        .then(async (permitSignature: any) => {
          await submitMintOperation({
            backend: VERIFIER_URL,
            nonce: 0,
            signature: permitSignature[0][0],
            to: account,
            signer: TXN_SIGNER,
        .catch((err: Error) => {
          console.log(err, 'err here');

What could be the possible reason for this?

Your above code does not show how you get to the value serializedMessage which makes it difficult to help. If you used our sponsored transaction example, then comparing your code with the example dapp code, you might miss the Buffer part.

import { Buffer } from 'buffer/';
const permitSignature = await connection.signMessage(account, {
                    type: 'BinaryMessage',
                    value: Buffer.from(serializedMessage.buffer),
                    schema: typeSchemaFromBase64(SERIALIZATION_HELPER_SCHEMA_PERMIT_MESSAGE),

Thank you @Doris, here is my code from the generateMintMessage function and I still get same error.

  const mintData = {
    owner: {
      Account: [account],
    metadata_url: {
      url: 'https://gateway.pinata.cloud/ipfs/QmZ3939dLLFzvYZjFnkdqACe2n9TQA8Rx4efbjaYTXteeu',
      hash: {
        Some: [
    amount: '1',

  const payload = serializeTypeValue(
    toBuffer(MINT_PARAMETER_SCHEMA, 'base64'),

  const message = {
    contract_address: {
      subindex: 0,
    timestamp: expiryTimeSignature,
    entry_point: 'mint',
    payload: Array.from(payload),

  const serializedMessage = serializeTypeValue(
    toBuffer(SERIALIZATION_HELPER_SCHEMA, 'base64'),

  return serializedMessage;

We have two sponsored transaction examples that showcase how you can construct the serializedMessage and provide it to the wallet connected via the walletConnect library (GitHub - Concordium/concordium-dapp-libraries: A coherent set of building blocks for making it as easy as possible for developers to build web-based dApps.). Does it help to follow along the code example?