Ethereum: How to create a valid signed message and obtain v, r, s for EIP-712 verification in Solidity?

I can not help you in the code for Ethereum: How to prepare the subscribed and confront V, R, S for the EIP-712 into solid.

The topic does not, I can give some community hand-being, how to sign and check the hash eip-712 into solidnosti:

** Correction of the Actual Signature of

To sprinkle the activity of the signature, you need to use the pursuit of the shagies:

1.

  • Submit the new coded record, using the function of ether.Createaccount.

  • Subscribe Combining, using the function of ethers.utils.sign, the indicative record and the composition for signatures.

That

`

{Ethers} Import; Ethers;

Const Account = Wat Ethers.Createaccount (‘My-Account’);

Const Message = ‘Address, World!’;

Const signature = Await Account.Sign (COLITION);

console.log (signature); // Pass the signature of

// To check the hash eip-712, you need to make a Clauiaturus

Const Keypair = Judat Ethers.getKey (Account.Address);

// Now, use the Clauiaturus to sign the new co -provision and again.

Const NewMessage = ‘New, Combining!’;

Const verifiedSign = wait keypair.sign (newmessage);

console.log (verifiedsignature); // Pass the verified signature in the formatte of the six

`

Related V, R, S for Returns EIP-712

Ethereum: How to create a valid signed message and obtain v, r, s for EIP-712 verification in Solidity?

To relate values ​​V,R and S For the EIP-712, you need to use the following goals:

1.

  • Submit the new coded record, using the function of ether.Createaccount.

  • Subscribe HTLC Struct (lurking over).

  • Use the function ethers.utils.recover, to draw valuesv,r ands for the EIP-712.

That

`

{Ethers} Import; Ethers;

Import {Red} from ‘Ethers/Utils’;

Const Account = Wat Ethers.Createaccount (‘My-Account’);

const htlcstruct = […]; // replace on HTLC Struct

// Signal HTLC Struct with ADRESS UNDER

Const signature = Await Account.Sign (HTLCSTRUCT);

console.log (signature); // Pass the signature of

// Using the restoration that the values ​​of V, R and s for the EIP-712

Const ExtRedsignature = Wait Exclistsign (Signature);

Console.log (Extredsignature.v); // Print V Consignment

Console.log (Extredsignature.r); // Put the values ​​of R

Console.log (ExtredSignature.S); // Puting values ​​s

`

Obraty unicania that the function of recovery is heard by the object of the Klavyshi, which contains valuesV, rand s. However, in order to use these values ​​in your contract, you need to implement them correctly and enhance them.

Failure, take up the ethereum for the ethereum to do for the add-in information about signatures and the EIP-712.

Ethereum Ripples Base58 Alphabet Strange

دیدگاه‌ها

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *