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...

КОМЕНТАРІ • 83

  • @sdfsfsfd437
    @sdfsfsfd437 2 роки тому +8

    Great video! And many thanks for all the explanations especially for assembly instructions.

    • @GL33T
      @GL33T Рік тому

      Assembly part definitely sealed the deal !

  • @Drekends
    @Drekends 4 місяці тому

    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!!

    • @MrCoreyTexas
      @MrCoreyTexas 3 місяці тому

      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.

  • @misanthropicresearch
    @misanthropicresearch 2 роки тому +18

    bro how can u be giving us this for free? just got a 150k job cz of you, THANKS

    • @plutus4047
      @plutus4047 2 роки тому

      Apart from Solidity what language did you learn brother to get a job?

    • @misanthropicresearch
      @misanthropicresearch 2 роки тому +1

      In my techinical interview, i've needed to code an NFT

    • @plutus4047
      @plutus4047 2 роки тому +2

      @@misanthropicresearch thanks for the response...I needed a job too so I learn Solidity..

    • @bilbobeutlin3405
      @bilbobeutlin3405 Рік тому

      @@misanthropicresearch could you use open zeppelin hahaha

    • @supadrasta
      @supadrasta Рік тому

      Can you share an example of coding an NFT? Thanks much

  • @salem232
    @salem232 2 роки тому +1

    😍awesome video , thank you🙏!

  • @pedrodorr8863
    @pedrodorr8863 Рік тому +1

    I love you dude, you are the real mvp

  • @MrCoreyTexas
    @MrCoreyTexas 3 місяці тому

    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?

  • @ThePersepolis32
    @ThePersepolis32 2 роки тому

    Great, a start to learn meta transactions.

  • @marouanchak
    @marouanchak 2 роки тому +3

    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

  • @brandonfowler1592
    @brandonfowler1592 Рік тому

    You are such a beautiful person.

  • @hunktang8996
    @hunktang8996 2 роки тому +2

    hello ni hao!
    How to convert an uint to a string? Thanks Teacher!

  • @zachz6620
    @zachz6620 2 роки тому +1

    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?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +1

      You will need, original message, signature and address to check that the signature is valid

  • @meka4996
    @meka4996 Рік тому

    This is amazing! Thanks

  • @福瑞黃
    @福瑞黃 2 роки тому +2

    May I have the second question? Why "\x19Ethereum Signed Message:
    32" ?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +1

      ethereum.stackexchange.com/questions/20962/should-signed-text-messages-use-the-x19ethereum-signed-message-prefix

    • @福瑞黃
      @福瑞黃 2 роки тому

      @@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 ?

  • @sicktastictv
    @sicktastictv 2 роки тому

    Great video!

  • @carlocarlo1635
    @carlocarlo1635 2 роки тому +2

    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?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +2

      yes it's called meta transaction or gasless transaction

    • @carlocarlo1635
      @carlocarlo1635 2 роки тому

      @@smartcontractprogrammer Thank you very much for the answer and as it is already verified in the chain

  • @karlBl00ck
    @karlBl00ck 2 роки тому

    thanks for this tutorial !

  • @NikhilKumar-ts6rz
    @NikhilKumar-ts6rz 2 роки тому

    Wow! Best explanation. I wonder why you have another video for the same ?

  • @jaystance9856
    @jaystance9856 2 роки тому +2

    What are the use cases for this?
    I am n ot yet sure why I will need to do this

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +2

      transaction relay, meta transaction, multisig, payment channels

    • @stefanl5944
      @stefanl5944 2 роки тому +1

      @@smartcontractprogrammer yo thx for being so active in your comment section, i was wondering the same thing.

  • @riazbacchus3962
    @riazbacchus3962 2 роки тому +1

    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.

  • @SomjitNag
    @SomjitNag 2 роки тому +1

    Very informative Video! Can you help me understand why u used metamask from browser console?

  • @福瑞黃
    @福瑞黃 2 роки тому +1

    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?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +2

      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

    • @福瑞黃
      @福瑞黃 2 роки тому

      @@smartcontractprogrammer Thanks so much!

  • @NN-si6cl
    @NN-si6cl 2 роки тому

    Super useful!

  • @kkkkkkjjj
    @kkkkkkjjj 9 місяців тому

    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?

  • @nellykantu8428
    @nellykantu8428 2 роки тому +1

    hello, when you said offchain is wallet does that mean onchain is smart contracts?

  • @devinetradable9669
    @devinetradable9669 2 роки тому +1

    In what situation would we be using this functionality? because it was really confusing to get the point

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +2

      multi sig, meta transaction, relays, payment channels, ERC20 permits, etc...

  • @darrenwho
    @darrenwho 2 роки тому

    Why would you want to sign something?

  • @elinajankovskaja3132
    @elinajankovskaja3132 2 роки тому

    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 !

  • @rachellee7235
    @rachellee7235 2 роки тому

    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?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +1

      some parts are interchangeable with calldata
      string must be either be memory or calldata

  • @jhaymes8220
    @jhaymes8220 2 роки тому

    Hey man, your videos are amazing. Can you make it possible that people could tip you?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому

      Ethereum - mainnet, testnet welcomed
      0xFab488A8Eb04c6c211CBFd15B1da021A9CC0Bd0c

  • @zahreddinesoualem3213
    @zahreddinesoualem3213 2 роки тому

    actually I really need to understand what are r and s mean ? are they private , and public key ? more explanation please sir.

  • @onkarkumar6325
    @onkarkumar6325 2 роки тому

    why you take sig.length == 65

  • @smnomad9276
    @smnomad9276 2 роки тому

    Excellent video! Is the full solidity course on your website free?

  • @nellykantu8428
    @nellykantu8428 2 роки тому

    hello, why isn't string calldata since its an external function???

  • @15mastersword
    @15mastersword Рік тому

    Thank you so much for the video! Do you happen to know if the ecrecover function is different on matic chain?

    • @smartcontractprogrammer
      @smartcontractprogrammer  Рік тому +1

      no

    • @15mastersword
      @15mastersword Рік тому

      @@smartcontractprogrammer ok thanks again for the content! I'll continue my search with regards to matic signatures :)

  • @AmitKumar-ou6xk
    @AmitKumar-ou6xk 2 роки тому

    Any way to purchase your course using cryptocurrency ?

  • @안성현-q4c
    @안성현-q4c Рік тому

    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?

  • @VicTorProStarT
    @VicTorProStarT 2 роки тому

    how to use personal_sign in etherjs ??

  • @vtech256
    @vtech256 2 роки тому +1

    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.

  • @milechain_yt943
    @milechain_yt943 2 роки тому

    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?

  • @pythusiast4701
    @pythusiast4701 Рік тому

    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?

    • @KalyanSingh-sd3jw
      @KalyanSingh-sd3jw Рік тому +2

      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.

    • @pythusiast4701
      @pythusiast4701 Рік тому

      @@KalyanSingh-sd3jw to let the contract know, you mean let the EVM know?

    • @pythusiast4701
      @pythusiast4701 Рік тому

      bytheway yup it answers my question. thanks alot.

  • @MrCoreyTexas
    @MrCoreyTexas 3 місяці тому

    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.

  • @enehizyosas
    @enehizyosas 2 роки тому

    could u please do an eip 712 signature and verification

  • @no-body7286
    @no-body7286 2 роки тому

    super ra bittu

  • @SUPERMAN_I4G
    @SUPERMAN_I4G Рік тому

    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.

  • @khizrshaikh9902
    @khizrshaikh9902 2 роки тому

    First

  • @SIDDHARTHKUMAR-mr6dv
    @SIDDHARTHKUMAR-mr6dv 2 роки тому

    why is ethereum.enable not working in my brave? i have installed metamask