|Home|

4th.Energy NFT Prototype

The 4thE Code


        

What's all this then?

You are looking at the prototype of a non fungible token (NFT) that contains an embedded 4th.Energy virtual machine that is running the compiled 4th.Energy code that is shown below the NFT.

What can I do with it?

To experiment with the NFT, you can draw inside the rectangle. If you click on the cross it will clear and you can start again.

Why is it special?

This demonstration is special because the virtual machine and demonstration program are all contained in the base 64 encoded text that is in the data tag of the object element embedded in this web page that displays the NFT.

<object 
    type="image/svg+xml" 
    data="data:image/svg+xml;e4th:[b64 encoded 4thE program];base64,[b64 encoded 4thE VM]">
</object>
                
For those that know web3, 4th.Energy creates a functioning program that can be emitted from an ERC721/ERC1155 smart contract. This means that a fully functioning 4th.Energy program can be retrieved by a browser from ethereum, and the program will function in the page without anything more than putting it an object tag.

How do I know it's real?

Use your browser inspect function to look at the page and the elements. This page is static with no server calls, and no external links. The javascript code linked in the html page is compiling and linking the 4th.Energy code, and inserting the object tag.

What is 4th.Energy

4th.Energy is a compiler, linker, virtual machine, and packager tool chain that I created to make the dynamic linked object data. The language is based on forth, which is a mostly syntax free assembly language that uses a data heap rather than registers for its state management. Forth has a tiny bit of syntax to make procedures known as "words", as well as to support some conditional logic. It is almost completely like assembly language to the point of making you crazy, while providing just enough syntax to stop you going crazy. Once you are used to it, you love it. Most virtual machines like Java and the Ethereum EVM are based on forth like designs.

Forth and other EVMs normally use direct address memory structures, however I added list and map operations and iterators so that standard JSON web data types are supported as the native data structures in 4th.Energy. Likewise, other EVMs either link to a host for platform specific operations such as mouse clicks and drawing, or in the Ethereum VM, no outside functions are supported at all. I added a host callback and ABI mechanism so that the host containing the 4th.Energy EVM can use browser functions as permitted by the browser's object context policy. As long as the program stays in its container, it's allowed to pretend it's a full web page including gaining access to the wallet plugin.

The 4th.Energy virtual machine is written in dart and compiled to minified javascript. After that, it's all 4th.Energy forth. The reason why I created the forth compiler rather than using JavaScript natively is because first, compiled forth is smaller and hence more blockchain friendly, and second, my vision of the future of 4th.Energy is for agent based systems where NFTs talk to NFTs. To achieve this I needed a programming language and virtual machine that supported the concept of "continuation" where a program can ship itself from one location to another at any part of program execution. This will become important as NFTs start to interact with NFTs.

The Intercomputer

With 4th.Energy it is now possible to create platforms that exist and operate entirely onchain, and utilize the full power of the blockchain and other platforms wherever desired. 4th.Energy will let us create a vast network of uncensorable and unstoppable interconnected programs that have the same trustless dynamics as smart contracts. When they are connected to each other, they create a global intercomputer.

What's Next?

I've just got started and there's plenty to do. I'll be listening to my network to work out how to make the most of the idea. Some obvious things...

You can DM me for now at @p_s_horne on twitter with specific questions.