FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

faceless-bytecode/bytecode at master · Raggaer/faceless-bytecode · GitHub

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Faceless Bytecode - generator

Simple generator for deploying a contract with the given hex string as the bytecode.

How

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

Example

"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