| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Simple generator for deploying a contract with the given hex string as the bytecode.
The generator does the following:
PUSH hex length PUSH hex offset PUSH dest offset - 0 CODECOPY - (destOffset, offset, length) PUSH hex length PUSH offset - 0 RETURN - (offset, length) STOP
Since smart contracts have a limit of 24 KB we cant use hexadecimal strings with more than 12.000~ characters. On this case only PUSH1 and PUSH2 have been implemented, with PUSH2 putting a uint16 onto the stack (more than enough for our character limit).
"Hello World" - 0x48656c6c6f20576f726c64
./bytecode -i 0x48656c6c6f20576f726c64 ====================================== 0x600b600d600039600b6000f30048656c6c6f20576f726c64
The following generated bytecode:
60 0b - PUSH1 11 ("Hello World" length)
60 0d - PUSH1 13 (Offset where the "Hello World" string starts in memory, either 13 or 15 depending on string length)
60 00 - PUSH1 00 (Destination offset where to copy the code)
39 - CODECOPY
60 0b - PUSH1 11 ("Hello World" length)
60 00 - PUSH1 00 (Offset from memory)
f3 - RETURN
00 - STOP
"Hello World" hex string...
| Back | FazBrowse Home | New Git URL |