---
# System prepended metadata

title: What is ExeToken

---

# What is ExeToken

## Cataloging smart contracts
Smart contracts not only facilitate the exchange of cryptocurrencies and FinTech services, but they are also increasingly being used as a persistent processing infrastructure for storing and sharing resources, such as images and fonts, and providing useful algorithms. However, there is a high barrier to entry for non-web3 developpers to make use of smart contracts deployed on Ethereum. Accessing a contract requires the 160-bit address, as well as the ABI that defines the method signature and processing results data structure. Often, programmers who are not the developers of the contract have limited means of acquiring this information, and they do not know where the contracts are located on the blockchain. This means that even if someone deploys useful data, algorithms, or utilities, there are limited opportunities for them to be utilized effectively.

## Make smart contracts more accesible, reusable, and tradable
In order for Ethereum to become the processing platform that anyone can use, several improvements need to be made to smart contracts.
1. To provide an easy way to identify smart contracts in addition to a 160-bit random string, such as by giving them easily recognizable names like ENS or categorizing them for systematic exploration.
2. The interface for using smart contracts from external code. For example, when calling smart contracts using 'ethers', it is necessary to obtain the ABI from somewhere or create it yourself, in addition to the address. This is often difficult for the reasons mentioned above. It is important to enable smart contract users to easily call them from their own code without knowing the address or ABI.
3. There is a need for mechanisms that motivate the construction of more algorithms and applications on the blockchain. There should be an incentive to justify paying gas to deploy to the blockchain, in addition to uploading to npm and PyPI. For example, mechanisms such as using NFTs to buy and sell ownership of smart contracts, or paying rewards based on the number of contract executions. If publishing libraries becomes blockchain-first, a more comprehensive and persistent processing platform can be realized.

## Our approach
We are building the following technologies towards the goals mentioned above. All of these work at layers above Solidity, and all assets are fully stored on-chain, so the mechanism will continue to work even if we disappear.　The demo version of these technologies on Goerli test network is available.

### ExeToken
ExeToken is an NFT-based technology that adds the ability to execute arbitrary functions to NFTs. By wrapping a smart contract with an ExeToken, it can be treated as an interface and avatar for the smart contract.
<img src="https://i.imgur.com/dkYPgHa.png" width="128px" height="158px"/>

ExeToken implements its own interface, 'execute', in addition to the ERC721 interface.

``` Solidity
/**
* Run the code of the specified token in the execution environment on Ethereum 
* @param tokenId token id 
* @param args the arguments passed when executing the code
* @return the execution result
*/
function execute(uint tokenId, Value[] memory args) external view returns (Value memory);
```

ExeToken stores source code as data, and dynamically executes that code on EVM through Solidity when the 'execute' method is called. See on-chain interpreter below for details.

With ExeToken, you can add the following features to your smart contract.
* Giving your smart contract a descriptive name and avatar image
* Classifying and organizing smart contracts by categories
* As long as you know the token id, you can execute the smart contract without the contract address and ABI.
* Collecting smart contracts just like regular NFTs. You can also monetize your code by buying and selling ExeToken NFTs on the marketplace

Our implementation of ExeToken is [here](https://github.com/Ikaruga-lab/exe-token).

### On-chain interpreter
On-chain interpreter is a programing language interpreter built as a smart contract. It receives source code as the argument and executes it on the blockchain dynamically. We have implemented a on-chain interpterter '[OnChainJS](https://github.com/Ikaruga-lab/on-chain-js)' that is a lightweight JavaScript interpreter to execte the function snippet. OnChainJS is used to implement the 'execute' method of ExeToken. OnChainJS absorbs the differences in the data structure of the arguments for smart contracts and processing results, making it possible to wrap various smart contracts into ExeToken. 
The diagram below shows how ExeToken and OnChainJS work together.

<img src="https://hackmd.io/_uploads/BJGynAarn.png" width="100%"/>

The code below shows an example how OnChainJS calls smart contract. The contract address, method signature, and ABI are all contained within the code and stored on the blockchain as ExeToken data, eliminating the need to specify them externally when executing the ExeToken.

```JavaScript
// Call OnChainJS contract itself
function callOnChainJS(code="function run() { return 'OnChainJS'; }") {
  return staticcallContract( // special function to call contract
    '0xeb4F5152cE54a9cb0A271DC537Bc7954e4d0dd4b', // contract address
    'interpretToString(string)', // method signature
    { type: "string" }, // return type ABI
    code); // argument
}
```

### Web service for building, managing, and cataloging ExeToken
We have released the demo version of the web service called '[archive](https://ikaruga.app/)' for experiencing ExeToken.　The archive is now running on Goerli test network and providing the following features.
* Building and minting ExeTokens while checking execution results and appearance
* Managing owned and created ExeTokens
* Browsing ExeTokens based on their name, category, and author (under development)

### ExeToken SDK
ExeTokens are not just collection items, they are processing assets that encapsulate smart contracts, algorithms and data resources.　You can call and use them from your code anywhere you have access to Ethereum. For more convenient use, we have prepared the SDK. [The SDK for JavaScript](https://github.com/Ikaruga-lab/exe-token-sdk-js) is available for now.
