|Home|

4th.Energy dApp Prototype

What's all this then?

This is a demonstration of a dApp to show how we can mint 4th.Energy programs as NFTs.

What can I do with it?

Select a radio button option and press "Load". The "Free Draw" option is the demo program from proof of concept #1, with improved sizing. You can draw on it with your mouse, and click on the cross to clear and start again. The "Hash Draw" option takes the entered hash and uses the drunken bishop algorithm to create a pattern from the random hash bits. You can change from black and white to colour, and you can also cycle through some random hashes I gathered from etherscan.io. You can also enter in your own hash.

Why is it special?

The "image" is actually an NFTC - an SVG running a virtual machine that also loads and runs a program. The technical among you can inspect the image and see the base64 encoded program constructed from the resources below the image. The virtual machine loads and links the object files from the compiled module code shown below the NFTC. The object files are converted to PNG images that can be minted. When you press "Load", the composition code line underneath is all that is used to construct the program that is loaded into the NFTC. This means that the code modules only have to be minted once, and the dApp can mint the composition line, and on each mint a unique NFT is minted with all code and parameters on chain. The NFTC will load and run on each view, so should the hash change (Eg. the NFTC is sold and a new owner address is emitted by the composition smart contract), the NFTC will also change. The hardest of all the hard things I have achieved here is "late binding" where you can choose the hash algorithm and a black and white or colour option, and the program "late-binds" the different modules into one executable. This proves that composition from many tiny modules stored on-chain is possible rather than having to mint monolithic programs of fully linked modules at compile time. This allows the "end-user" composition mint to have the same or less cost as an ordinary IPFS url.

What's working here?

The compiler, linker, and binary code format, the virtual machine, SVG boot loader, PNG compression/decompression of code modules, composition, program loading and running. All of the tools that are being called to compile the code, pack the binary code, create the PNG/NFT code packs, and bang it all together, are using the 4th.Energy node that also serves this page.

What's Next?

Three things - 1) this is a spec for the smart contract development that can now start. 2) I want to see if I can boot the whole dApp shebang from an ETH node that has an open port for web access, cutting out the need for gatekeeper dApp web servers. 3) A little nap before I start 1 & 2.

The dApp

The NFT Computer

Compose

Free Draw
Hash Draw
Hash Address
Draw Algorithm

Composition Code

This code is minted on chain to create the NFT to the left.
 
The format of the string is:
[boot token];[host token];[libs token list];[late bind list];[args list];

The Boot Loader

Base64 Encoded

Token ID

The Host

Base64 Encoded

NFT Display

Token ID

The Hash Encoder Library

4th Energy Code


        

E4VM Encoded

Base64 Encoded

NFT Display

Token ID

The Side Step Library

4th Energy Code


        

E4VM Encoded

Base64 Encoded

NFT Display

Token ID

The Hash Draw Program

4th Energy Code


        

E4VM Encoded

Base64 Encoded

NFT Display

Token ID

Option 1 - The Block Draw Library

4th Energy Code


        

E4VM Encoded

Base64 Encoded

NFT Display

Token ID

Option 2 - The Blob Draw Library

4th Energy Code


        

E4VM Encoded

Base64 Encoded

NFT Display

Token ID

The Free Draw Program

4th Energy Code


        

E4VM Encoded

Base64 Encoded

NFT Display

Token ID