signMessageWithoutSalt

WIF:
Message:

Result:


          import { wallet, u } from "@cityofzion/neon-core";

          const parameterHexString = Buffer.from(message).toString('hex');
          const lengthHex = u.num2VarInt(parameterHexString.length / 2);
          const concatenatedString = lengthHex + parameterHexString;
          const serializedTransaction = "010001f0" + concatenatedString + "0000";
          const data = {
            message: message,
            publicKey: publicKey,
            data: wallet.sign(serializedTransaction, privateKey),
          };
        

signMessage

WIF:
Message:

Result:


          import { wallet, u } from "@cityofzion/neon-core";
          import { randomBytes } from "crypto";

          const randomSalt = randomBytes(16).toString("hex");
          const targetMessage = randomSalt + message;
          const parameterHexString = Buffer.from(targetMessage).toString('hex');
          const lengthHex = u.num2VarInt(parameterHexString.length / 2);
          const concatenatedString = lengthHex + parameterHexString;
          const serializedTransaction = "010001f0" + concatenatedString + "0000";
          const data = {
            salt: randomSalt,
            message: message,
            publicKey: publicKey,
            data: wallet.sign(serializedTransaction, privateKey),
          };
        

verifyMessage

Original Message:
Salt(optional):
Data:
PublicKey:

Result:


          const message = salt + originalMessage;
          const parameterHexString = Buffer.from(message).toString('hex');
          const lengthHex = u.num2VarInt(parameterHexString.length / 2);
          const concatenatedString = lengthHex + parameterHexString;
          const messageHex = "010001f0" + concatenatedString + "0000";
          const result = wallet.verify(messageHex, data, publicKey);