Verify Signature | Solidity 0.8
Вставка
- Опубліковано 5 жов 2024
- Verify signature with Solidity
#Solidity #SmartContract #Ethereum #スマートコントラクト
Remix
remix.ethereum...
Code
solidity-by-ex...
Take a course
www.smartcontr...
Follow
/ programmersmart
/ discord
t.me/smartcont...
smartcontractp...
Great video! And many thanks for all the explanations especially for assembly instructions.
Assembly part definitely sealed the deal !
I was banging my head for three days trying to figure out how to sign a message and your video finally helped me, thanks a lot!!
Signing in bitcoin and ethereum is one of the hardest things to get right. But it's extra complicated in bitcoin's UTXO model since you can have 1 or more inputs, and then with all the Sighash possiblities that makes it 6x more complicated. And it does all kinds of weird things with the scriptSig and sequence number. It'll make your eyes bleed and your head explode, frankly.
bro how can u be giving us this for free? just got a 150k job cz of you, THANKS
Apart from Solidity what language did you learn brother to get a job?
In my techinical interview, i've needed to code an NFT
@@misanthropicresearch thanks for the response...I needed a job too so I learn Solidity..
@@misanthropicresearch could you use open zeppelin hahaha
Can you share an example of coding an NFT? Thanks much
😍awesome video , thank you🙏!
I love you dude, you are the real mvp
what you start doing around 11:30 is really cool, that you can talk to metamask in a javascript console and make it "dance". Don't know if this applies to other walllets like Rabby or Xdefi?
Great, a start to learn meta transactions.
Thank you very much for the quality of your content. I have a question regarding the recover function, can we consider it as a way of implementing a zero knowledge function in the way we can verify that you signed a secret message without knowing exactly what the message is ? Have a nice day
I don't know much about ZK but yes I think it's correct
You are such a beautiful person.
hello ni hao!
How to convert an uint to a string? Thanks Teacher!
Aweome video. Can you tell me though in practial terms... do i have it correct that i would use this sort of thing in a situation like this....…. Say someone sends me a message that says … “Hey dude”.
If I want to verify who sent me this message ill need their…
1.)address
2.)the message they sent (“hey dude”)
3.)their signature from when they signed the message and sent it to me.
If you have all 3 of those things you are saying I would be able to follow the rest of the steps and verify the person who sent me the message? If I am understanding this correctly, than how do you get their signature (#3)? I'm guessing that is usually sent along with the message right?
You will need, original message, signature and address to check that the signature is valid
This is amazing! Thanks
May I have the second question? Why "\x19Ethereum Signed Message:
32" ?
ethereum.stackexchange.com/questions/20962/should-signed-text-messages-use-the-x19ethereum-signed-message-prefix
@@smartcontractprogrammer Thanks for your reply, it's really nice of you. But I still do not understand that the purpose to add "\x19Ethereum Signed Message:
32" , will it increase the safety ? or it just a rule and a must ?
Great video!
excellent, very good explanation, thank you. My question is if the sign is made with the private key, can a transaction be signed and how is it sent to the blockchain?
yes it's called meta transaction or gasless transaction
@@smartcontractprogrammer Thank you very much for the answer and as it is already verified in the chain
thanks for this tutorial !
Wow! Best explanation. I wonder why you have another video for the same ?
Solidity 0.5 and 0.8
What are the use cases for this?
I am n ot yet sure why I will need to do this
transaction relay, meta transaction, multisig, payment channels
@@smartcontractprogrammer yo thx for being so active in your comment section, i was wondering the same thing.
would someone be able to explain the purpose of using the code described here? Why would I need to verify a signature off-chain?
and thank you.
commonly used for relaying transactions
Very informative Video! Can you help me understand why u used metamask from browser console?
Metamask doesn't have feature to sign message
I have struggled very long here. One of the questions is, since the _sig.length=65, how come the 96 of (add(_sig, 96) come from? we only have 65, right? so the 96?
sig length = 65, but there is extra 32 bytes stored in front of the sig, it stores the length of the sig
32 (len) + 65 (sig) = 97
@@smartcontractprogrammer Thanks so much!
Super useful!
How can i generate the signature directly using solidity, i.e. without using metamask or web3js? is there any predefined function in solidity to do so?
hello, when you said offchain is wallet does that mean onchain is smart contracts?
yes - onchain = transaction
In what situation would we be using this functionality? because it was really confusing to get the point
multi sig, meta transaction, relays, payment channels, ERC20 permits, etc...
Why would you want to sign something?
Hello ! Thank you for the video ! I am currently trying to do some contracts myself and I need to verify if a string is an under email form. I already have a regex but I just can't understand how to use them on solidity, do you have any tips ?? Have a nice day !
You are awesome! I wonder, you used memory a lot like verify(address _signer, string memory _message, bytes memory _sig. May I know why? Could the function work without memory?
some parts are interchangeable with calldata
string must be either be memory or calldata
Hey man, your videos are amazing. Can you make it possible that people could tip you?
Ethereum - mainnet, testnet welcomed
0xFab488A8Eb04c6c211CBFd15B1da021A9CC0Bd0c
actually I really need to understand what are r and s mean ? are they private , and public key ? more explanation please sir.
why you take sig.length == 65
Excellent video! Is the full solidity course on your website free?
some free challenges
@@smartcontractprogrammer Are all challenges free? Thanks for replying!
hello, why isn't string calldata since its an external function???
Thank you so much for the video! Do you happen to know if the ecrecover function is different on matic chain?
no
@@smartcontractprogrammer ok thanks again for the content! I'll continue my search with regards to matic signatures :)
Any way to purchase your course using cryptocurrency ?
After the smart contract code is released, we want to prevent the use of our public method function in Dapps developed by others. Is it possible?
add only owner modifier
how to use personal_sign in etherjs ??
The statement: " ethereum.request({ method: "personal_sign", params: [account, hash] }); " is no longer working. It returns an error: code: -32602 message: "Invalid parameters: must provide an Ethereum address." Has anyone else had this issue? Thanks for any info.
Pls I want to withdraw my liquidity using contract directly from a pancakeswap fork but apparently I need to use the remove liquidity with permit function and it needs a input called v r s
How do I get it?
write a script using web3.js or ether.js
In the _split() funciton we required the _sig.length == 65, whereas the signature output is (in my case) 0x5007f524bf1a4b1f40b8843a94d3a980a810e1b99b2f108f7127ed83128654de681c5f41d3446c2702494c7e1ee260a998af9a68ffde4fc22ce9341b350448c11b. The length is more than 65. How is it actually working?
Actually, your string is 132 characters long , which is standard signature output. But the first 2 characters "0x" are just to let the contract know that it is bytes data and not string. Rest 130 character, each one of them is hexadecimal having size 4 bit size. so 130 * 4 = 520 bits = 65 bytes. so , i hope that makes sense. great question btw.
@@KalyanSingh-sd3jw to let the contract know, you mean let the EVM know?
bytheway yup it answers my question. thanks alot.
Not a fan of having "_" prefixed to all your function arguments. Makes the code look ugly af. I know it's necessary in set() type functions. It's like how gcc assembly syntax is ugly af but TempleOS assembly syntax is beautiful and elegant.
could u please do an eip 712 signature and verification
super ra bittu
Ngl, I love your videos, but it's now getting hard and boring for me to understand. Maybe I will just keep going and practice when I am done.
First
why is ethereum.enable not working in my brave? i have installed metamask