Advanced Solidity: How to Program in Pure Yul

Поділитися
Вставка
  • Опубліковано 28 гру 2024

КОМЕНТАРІ • 31

  • @Hupa21
    @Hupa21 2 роки тому +5

    Mate! You are an absolute godsent in the Yul world (a world where there is no proper documentation on how someone might even deploy Yul). Thank you so so so very much! This is very helpful for my Bachelor's Thesis on Yul. Wish you all the best.

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

      Thank you very much! I am very happy that you found this useful!

  • @Banksy_said_hi
    @Banksy_said_hi 10 місяців тому +2

    I am very happy to find you channel!

    • @cryptojesperk
      @cryptojesperk  10 місяців тому

      Thank you! I am thrilled to hear it -- thanks for watching and supporting the channel 🙏

    • @pulsechainalltheway1845
      @pulsechainalltheway1845 5 місяців тому

      Same here❤, so many amazing videos. I have been watching the videos all day

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

    This was excellent. The only thing missing was input parameters to the functions, but we can dig that out of the docs I think.

    • @cryptojesperk
      @cryptojesperk  Рік тому +3

      Thank you! And thanks for watching. Yes, for this is part 1 - for part 2 I have a much more complex example here: ua-cam.com/video/F-Wo5D-IX9s/v-deo.html where I code up a full ERC1155 in pure Yul! It has parameter examples to be sure

  • @TwoVera
    @TwoVera 11 місяців тому +1

    Great job. But is there a way to inspect the memory during runtime? For example in c or c++ you can debug line by line and inspect that heap/stack of the 32bit data?

    • @cryptojesperk
      @cryptojesperk  11 місяців тому

      Thank you! And thanks for watching. You can try this: `forge test --debug testFunctionName`. Also, and not directly to your question, there's a Yul console.log

    • @TwoVera
      @TwoVera 11 місяців тому

      I havent used forge yet. I usually use Hardhat. Does forge provide a debugger similar to Remix's? On remix I can inspect the memory/stack and walk through the code (jump over/go into etc) like a traditional debugger @@cryptojesperk

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

    Really interesting, can the deployed contract written by Yul be able to verify on network explorer, etherscan perhaps

  • @0xTyfn
    @0xTyfn Рік тому +1

    You are doing amazing bro! 👊 The only thing sucks that is writing ABI ourselves 🤦‍♂🤦‍♂, but I wasn't surprised that is not possible.

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

      Appreciate it! Yes, that's indeed a bit annoying having to write our own ABI! Perhaps this will be supported in the future, though! Thanks for watching and appreciate the support 🙏

    • @0xTyfn
      @0xTyfn Рік тому +1

      Around 8-10 mins, you mentioned that for gas cost purposes we could use "name_deployed" instead of "runtime". Any documents, links to point me for further digging?
      Thanks 🙏

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

      ​@@0xTyfn Some devs will gas golf to minimize the gas cost of function calls by putting as many zeros in the function signature as possible. Here are some good resources on that:
      - twitter.com/Jeyffre/status/1506286755515088899?s=20
      - blog.emn178.cc/en/post/solidity-gas-optimization-function-name/
      And some tools to help optimize your function name:
      - github.com/jeffreyscholz/solidity-zero-finder-rust
      - emn178.github.io/solidity-optimize-name/

  • @Surya-d4r3d3v1l
    @Surya-d4r3d3v1l Рік тому +1

    How can we interact with the contract if we have only address of the contract without abi and bytecode.
    For example i want to call the myFunc from another contract , how to define the interface for that and call it ,as we dont have function name in the yul contract .

    • @cryptojesperk
      @cryptojesperk  Рік тому +2

      Thank you for watching and for your question!
      So, if you create a Yul contract with functions including "myFunc" you will also need to create a function selector (a "hub"): Something that directs the call to the contract to the right function within your contract. The function selector you implement in Yul should simply take the calldata and pick the first 4 bytes of that calldata. Then, it should compare those 4 bytes to the equivalent signature of your "myFunc()" function, which will change if you have input parameters to it as well.
      So you don't need an ABI or an interface etc. to call the myFunc() function. You just need to know what the function name is so that you can create the right calldata. The interface is what allows Solidity and the "abi.encode..." functions to do this automatically for you. But you can do it by hand too, it's not that bad.
      Note that the solidity compiler handles all this for you normally, but in Yul we need to create the function selector in the contract ourselves.
      Does this make sense? Happy to clarify further.

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

    Done

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

    I would really like to see yul in a production scenario. When is it useful?

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

      You can start programming in Yul right now! Go to the link in the description where you can find my code - feel free to copy and modify as you need! Thanks for your question and for watching :-)

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

    Does hard hat require a Windows PC?

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

      No! You can get started in other operating systems. Thank you for watching 🙏

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

    Sir I have a doubt !
    Is it necessary to learn yul to get a high paid BlockChain developer job ?

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

    We need more smart contract hacking videos

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

      Those are exciting! Working on it; thanks for the feedback and for watching!

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

    👍

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

    313

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

    Sir I have a doubt !
    Is it necessary to learn yul to get a high paid BlockChain developer job ?

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

      The answer to this will vary depending on who you ask and more details about your situation.
      If I may make some assumptions, I can attempt an answer: Since you indicate you want to be at the top of developers, and I assume you will want to program in Solidity, then: Yes, a thorough understanding of Yul would be necessary. This is because it's often used as the "assembly" block within Solidity (to access more low-level functionality and/or to save gas). And at times, you might want to write entire contracts within Yul (I have seen that less often, though). Overall, it will increase your understanding of Smart contract developments (I recommend you program yourself either an ERC20, ERC115, or similar).
      You will come to appreciate the abstractions that Solidity offers as well.
      But that is of course, just my personal view.