Skip to content

Nanobridges

Introduction

As the Web3 ecosystem continues to expand, the demand for secure, efficient, and versatile cross-chain communication solutions has never been higher. Enter nanobridges – a revolutionary application of the Escrin autonomous computing framework that leverages Trusted Execution Environments (TEEs) to provide developers with unparalleled customization and performance.

How Nanobridges Work

At the core of nanobridges lies the Escrin framework, which uses Trusted Execution Environments (TEEs), decentralized secret management, and on-chain roots of trust to establish highly secure enclaves of computation, known as Escrin Workers. Escrin Workers can execute JavaScript, Wasm, and Python code with efficiency, privacy, and integrity.

Nanobridges are special-purpose Escrin Workers that facilitate cross-chain communication. A nanobridge can execute custom message-passing workflows with speed efficiency on par with a native virtual machine instances due to the integrity properties of TEE and cryptographic attestations of machine identity. Additionally, the privacy properties of TEE enable fetching data using credentials like API keys, and selective disclosure of secret fetched data.

If you are familiar with the Avalanche-Ethereum bridge, nanobridges are built on very similar security technology, but are user-programmable for precise control over cost, decentralization, robustness, and performance.

Nanobridges vs. Traditional Bridges

To better understand the advantages of nanobridges, let's compare them to a traditional message-passing bridge like Celer IM, Chainlink CCIP, and Axelar.

While the traditional bridge provides a secure and reliable way to communicate between the networks, it has some limitations:

  1. Speed: A traditional bridge can often take several minutes post-confirmation to pass a message between chains due to factors outside of a developer's control like batching, proofs, and consensus.
  2. Cost: Users must pay gas on both networks to initiate a message passing event, which is wasteful if the data is available through read-only calls.
  3. Flexibility: The traditional bridge only moves bytes from one chain to another and cannot be used for complex, multi-step, and multi-chain workflows.

In contrast, nanobridges offer:

  1. Speed: Developers can customize the speed of message bridging, enabling sub-second cross-chain communication when needed.
  2. Cost: With no additional fees beyond the base hardware costs, nanobridges provide a more cost-effective solution for high-volume requests.
  3. Flexibility: Nanobridges can execute multi-chain and off-chain pipelines, support complex conditional logic, and even retrieve data from Web2 sources.

This comparison assumes that a network even has traditional bridge support, which is often not the case for newly launched and up-and-coming chains that must wait up to several months after paying a very large sum of money for integration. In cases like this, nanobridges are ideal for bootstrapping connectivity.

Real-World Example

To better illustrate the potential of nanobridges, let's explore a concrete example in the NFT space:

The Rose Portal, now archived after fulfilling its purpose, was one of the first nanobridge-enabled apps built using Escrin. The Rose Portal allowed users to migrate NFTs from old sidechain of the Oasis Network to a new one. The network does not support bridging between sidechains, and traditional bridges had not yet moved in, so nanobridges were the ideal–and only–solution.

The operation of the Rose Portal nanobridge was simple and straightforward:

  1. a NFT holder locks a token on the old chain into the bridge contract
  2. the nanobridge worker sends a message to the bridge bridge contract on the new chain to transfer a clone of the NFT to the user
  3. the nanobridge worker locks the NFT on the old chain into the bridge contract
UserBridge contract(old sidechain)  1. transferFrom(user,_,id)NanobridgeWorker2. Transfer(user,_,id)  Bridge Contract(new sidechain)4. lock(id)3. mintTo(user, id)

In total, the bridging component of the nanobridge worker totaled about 65 lines of straightforward and easy-to-audit JavaScript code. This level of convenience is enabled by the integrity properties of decentralizable TEE that Escrin provides.

The Rose Portal, although a simple application, neatly demonstrates the utility of nanobridges, especially as a quick and easy solution for an otherwise intractable problem.

Further Applications

Having supreme flexibility without compromising on security and decentralization, nanobridges can be the foundation for a variety of next-generation Web3 applications including

  • Intents: A trustworthy Escrin worker can seamlessly execute user intents across chains with programmable logic and a complete and simultaneous view of all network states. If you wanted to make an AI robo-advisor marketplace, this is how you would do it.

  • Real World Assets (RWA): Nanobridges can extract data from Web2 sources, including users' accounts, thereby establishing a secure link with DeFi.

  • GameFi: With the ability to run JavaScript and Python programs with integrity and privacy, they're ideal for intricate games that rely on private shared state, random elements, and immediate interactivity.

Getting Started with Nanobridges

In summary nanobridges offer a powerful and flexible solution for developers seeking to push the boundaries of cross-chain communication.

One can begin development with nanobridges by forking the Rose Portal code, running through the Escrin tutorial, or asking around in our Discord channel where our dev team will be more than happy to help you learn more.

Nanobridges: the full power of a VM with the security of a bridge