Raggaer / faceless-bytecode

Onchain NFT collection using raw bytecode contracts for SVG data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Faceless Bytecode

NFT collection that uses custom bytecode generated contracts for storing SVG data on-chain. The contracts that hold the SVG data contain hexadecimal strings as their own deployed bytecode.

Since the contract bytecode does not contain all the normal clutter the gas used for deployment is reduced. This method allows to deploy almost 24 (12, since hex uses 2 bytes every byte) KB full SVG strings using less gas than storing the SVG data on an immutable variable.

bytecode

Simple bytecode generator used for the SVG data. The contract deployment apart from the hex string only contains between 13 to 15 bytes of bytecode clutter.

Gas deployment differences

As seen on the hardhat/scripts/deploy-svg-compare.js script; For a 650 B SVG (1.27 KB when hex encoded) the results are the following (Ganache local node):

Gas for raw bytecode 190286
Gas for contract with data 654925 (344%)

About

Onchain NFT collection using raw bytecode contracts for SVG data


Languages

Language:JavaScript 53.2%Language:Solidity 37.5%Language:Go 9.3%