The TokenScript Framework: unlocking a new frontier in tokens as a digital primitive

LukeSVG
Smart Token Labs
Published in
4 min readJun 26, 2024

The TokenScript Framework provides a pathway for web3 developers and entrepreneurs to unlock the next frontier in tokens as a digital primitive.

Much like the evolution of previous digital primitives such as websites and mobile apps, tokens are set to explode in both utility and application as they become far more advanced. The exact nature of these advanced applications is not yet fully understood, but it is likely to herald innovation and disruption akin to websites evolving from brochureware to ecommerce. Or mobile apps evolving from simple games to on-demand marketplaces for just about everything.

The TokenScript Framework is one of the approaches to upgrading tokens to “mobile app-like” interactive objects, pushing tokens beyond their traditional limits. It integrates a trustless, verifiable user interface (UI) directly into the token and securely links this UI to the token via ERC-5169.

The TokenScript Framework comprises four core components: Smart Layer Network, Smart Token, Smart Token Viewer and Smart Token Explorer. The main architecture is below:

Let’s explain it in plain English:

  1. The Smart Layer Network comprises a set of nodes named “smart layer network service node” that support the running of smart tokens.
  2. A smart token has a token-specific frontend which is also verifiable.
    A verifiable token frontend makes the whole app trustless; unlike current dapps, users must trust the dapp providers.
  3. Smart Token Viewer is a secure sandbox for verifying and running smart tokens.
    • It is loaded from the network, and its update asks for the voting of all the nodes in the network.
    It can be embedded or standalone.
  4. Smart Token Explorer is an official site for users’ smart token management.
    Like Smart Viewer, it is also hosted by nodes in the network.
    Its domain is backed by the domain enhanced by Web3 Technology.

Smart Token

Conceptionally, a smart token can be seen as the following:

One smart token is a verifiable mini-app with more:

  • Portable, it can run on any dapps or wallets embedding smart viewer.
  • Composable smart tokens can work together to solve complex workflow.
  • Addressable, each token has a URI for access.

At the same time, it is self-described:

  • Source token frontend
    - Signature
    - Last updated
  • Spec of token behaviour
    - Methods
    - Messaging

Smart Token Explorer

Smart Token Explorer can be seen as a user’s smart token wallet:

  • Its domain is a web3-enabled domain.
  • Its source code is loaded from a decentralised network and can not be updated randomly.

For loading smart tokens

  • It will load all smart tokens owned by users in the registry contract automatically.
  • Else, a user can add them manually.

It looks like the following:

Smart Token Viewer

Smart Token Viewer is a secure sandbox for running a smart token.

  • 1 smart token must be running in a viewer.
  • To the viewer, the smart token is similar to a Cloudflare worker in the container.
  • All external handlers are injected by the viewer, some candidates:
    - eth provider, http client, storage …
  • The communication between tokens is built on top of the channel.

It is also the controller of smart tokens

  • Verify its correctness.
  • Update the code

Like Smart Token Explorer, it is also loaded from a decentralised network. Other features include:

  • It can be embedded in a dapp or wallet
  • It can be running as a standalone app with either of the following
    - A smart token URI
    - Clicking a smart token in Smart Token Explorer
  • It is a plugin system which can be extended by Smart Action.

A smart action can be seen as an extension of a smart token viewer. Its features and behaviours are TBD, so we will ignore the details in this article.

Smart Layer Network

In this decentralised network, nodes named “smart layer network service nodes” are running. For each node:

  • It is a peer in the decentralised network.
  • Hosting the key component’s source code
    - Smart Token Explorer & Smart Viewer
  • It will save the runtime data in the network
    - Registry: SLN peer and smart action
    - Peer data for monitoring and reputation checking
  • Finally, it is “autononymous”:
    - Permissionless
    - Governance
    - Voting-based source code updating

Roadmap

Split into milestones. You can see more details in the Roadmap.

Conclusion

The TokenScript Framework will unlock the next frontier in tokens as a digital primitive.

Leveraging the power of the Smart Layer Network, verifiable smart tokens, secure sandbox environments, and decentralized management tools, this framework addresses many of the trust and security issues that are plaguing the blockchain space.

As this technology continues to develop, it promises a more secure, efficient, and user-friendly approach to managing digital assets and interacting with the web.

The next wave of tokens as a digital primitive is almost upon us and the TokenScript Framework is set to lead the way.

--

--