I'm following this repo (https://github.com/GuidoDipietro/solana-ed25519-secp256k1-sig-verification) to create and verify signature, but the way to create instruction isn't used anymore so I'm trying to do the method way. I have a message and sign it using @noble/ed25519

let signature = await ed.sign(
            owner.secretKey.slice(0, 32)

In program, my input type is msg: Vec, sig: [u8; 64] and after build the program, the types required are 'ArgsTuple<[{ name: "msg"; type: "bytes"; }, { name: "sig"; type: { array: ["u8", 64]; }; }] So how can I convert these type for the function?

1 Answer 1


For your message, assuming you want utf-8 encoding, you likely need Buffer.from(MSG, 'utf8'), and to make a Vec more specifically, you need to prefix it with the size of the msg, encoded as a u32, so using buf.writeInt32LE(MSG.length). And then ed.sign already gives a Uint8Array, so you can just send that in as is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.