@@smartcontractprogrammer is there a way to encode a selector (so I actually can call only function getMeaningOfLife to return 42 and no other function will return this number)?
The name is a joke from the book Hitchiker's Guide to the Galaxy. I found it strange that you can name the function anything and the contract will run regardless. The low level stuff is kind of strange, and you would really need to go through a separate tutorial or playlist just for that. assembly{} is like assembly language, and what he's doing here is more like machine language. I guess this is a good introduction.
@@smartcontractprogrammer Also why at 2:32, the sequence is 1) PUSH1 0x2a 2) PUSH1 0 3) MSTORE instead of the other way around? Like 1) MSTORE 2) PUSH1 0 3) PUSH1 0x2a
because the mstore() opcode by default uses 32 bytes; its just the way it is. so when you later retrieve that object in memory with the return() opcode you must return the same sized data, which is 32bytes
Using your sample code, if I try to deploy the Icontract code at the address given in the log, I get "This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly."
I have a doubt: How to convert the op code to byte code. You didn't tell which tool to use to convert the op code to the byte code you came up with I ask this because in the future if I want to write another byte code contract, I would need a way to convert the op code into byte code
0:00 - Intro
0:16 - Runtime code
3:20 - Creation code
6:07 - Factory contract
9:11 - Demo
EVM playground
www.evm.codes/playground
Code
solidity-by-example.org/app/simple-bytecode-contract/
Take a course
www.smartcontract.engineer/
Can u explain elliptic curve and how to use it ? , & thank you 🙏
Amazing, was having some difficulty understanding the MagicNumber Challenge. Now, I'm good to go. Thanks again
same.
Are you trying to become a smart contract auditor
My hero helping me with ethernaut now, love it
Ethernaut solutions soon :D
More low level stuff like this 💯
Love your videos, also love the reference to the Hitchhiker's Guide to the Galaxy.
Where does getMeanigOfLife function come from?
the smart contract always returns 42 so it doesn't matter what function you call
@@smartcontractprogrammer is there a way to encode a selector (so I actually can call only function getMeaningOfLife to return 42 and no other function will return this number)?
The name is a joke from the book Hitchiker's Guide to the Galaxy. I found it strange that you can name the function anything and the contract will run regardless. The low level stuff is kind of strange, and you would really need to go through a separate tutorial or playlist just for that. assembly{} is like assembly language, and what he's doing here is more like machine language. I guess this is a good introduction.
But why we need to return 32 bytes from memory at 0:41?
42 is stored as uint256
uint256 needs 32 bytes
@@smartcontractprogrammer Also why at 2:32, the sequence is 1) PUSH1 0x2a 2) PUSH1 0 3) MSTORE instead of the other way around? Like 1) MSTORE 2) PUSH1 0 3) PUSH1 0x2a
@@ken14250 Inputs are consumed from top of the stack
So the first input must be stored last (top of stack)
because the mstore() opcode by default uses 32 bytes; its just the way it is.
so when you later retrieve that object in memory with the return() opcode you must return the same sized data, which is 32bytes
Using your sample code, if I try to deploy the Icontract code at the address given in the log, I get "This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly."
don't deploy, load the interface at the address
@@smartcontractprogrammer Thank you!
How did you manage to get the creation code from the opcodes?
here's the runtime code but creation code works the same way:
//0x60 0x2A //push v
@@pan-galactic-gargleblaster thank you
I have a doubt:
How to convert the op code to byte code.
You didn't tell which tool to use to convert the op code to the byte code you came up with
I ask this because in the future if I want to write another byte code contract, I would need a way to convert the op code into byte code
ethervm.io/
Thank you 🙏
Fantastic!
Does this mean that fallback is not something that has a signature?
yes I think fallback is a function without a signature.
Magic Number 🪄