Hello,
I have some questions regarding the smart wallet contract methods. For the transfer parameters, I just need some clarification on what the service_fee_recipient, will that be an account address or a public key? Also, regarding the signature, I understand that it will be obtained by signing a message with a private key. Could you shed more light on that too? Thanks
The service_fee_recipient
is an ed25519 public key.
The smart contract verifies your signature using ed25519
signature protocol.
The flow will be:
- Generate a private-public key pair generated with the
ed25519
schema. - Generate the message hash to be signed (either by implementing the same logic for generating the message hash off-chain or by calling e.g. the
getCcdTransferMessageHash
method in the smart contract) - Signe the message hash off-chain using the
ed25519
schema. - Submit your signature to the smart contract (with the other input parameters) to authorize the action.
Hello,
i used tweetnacl to generate keypairs and signed the message
const message = { entry_point: "transferCcd", expiry_time: await this.getExpiryTime(), nonce: 0, service_fee_amount: new CcdAmount(0), service_fee_recipient: "577f47c193a11f205b1a3df9bae544d67f861dcf7955af8bd947f3062ea9d690", simple_transfers: [ { to: "fac4c397e3c1b2fd3f68184207216ec5840ba2ba71e4aa1998ba6211db6cc495", transfer_amount: new CcdAmount(amount) } ] }
Using the hash generated from getCcdTransferMessageHash
with the private to get the signature using this payload as param for the transferCcd
{ message, signature, signer: "6dd51b106da4d55c1fa1647464e88d007d5ef940178c3869413a0f97ba047df5" }
I still get rejectReason: -6,
which is Wrong signature
despite verifying off-chain
Hi Kizito,
were you able to verify the signature by now? This error often occurs if the hash from the object signed is slightly different from the input parameter you provide to the smart contract function. Could it be that your this.getExpiryTime()
is different from the value signed vs the value provided as an input parameter to the smart contract?