Unlocking Multichain Web3 with NEAR Chain Signatures
Written by: Matt Lockyer & Proximity Labs
TL;DR:
- Demystifies NEAR’s new protocol feature, Chain Signatures, both for developers and end users.
- Compares how multichain Web3 apps work, before and after Chain Signatures.
- Presents two multichain app examples in which Chain Signatures improves DevX and UX: a DAO and NFT minter.
- Describes how Chain Signatures can add a layer of smart contract functionality to non-smart contract chains through a Bitcoin Runes airdrop example.
Multichain Apps Before vs After Chain Signatures
NEAR Chain Signatures introduces a new approach to building multichain Web3 applications that provides a better experience for developers and users. Before, developers would write application layer smart contracts for each chain, possibly in different languages, requiring new smart contracts and audits every time. The re-implementation and re-deployment of application logic introduce several risks for users while switching networks and feature disparity among implementations creates poor user experience (UX). Additionally, users are often required to bridge assets or messages from chain to chain, introducing even more risk and even worse UX.
Developing multichain Web3 applications before Chain Signatures:
Without Chain Signatures
For developers and users, each additional chain adds application, account, and contract complexity. In this model, bridges are necessary to migrate assets and perform transactions on a new chain. This forces both developers and users through several preparatory steps before they can experience apps on their chain of choice.
Now, Chain Signatures alleviates the burden of maintaining different contracts, deployments, and audits for each chain, by allowing developers to move a majority of the application logic to a single NEAR smart contract. Developers can focus on the UX of their application, instead of maintaining several different contracts on multiple chains. Users also benefit from not bridging assets. Instead, they deposit assets from the chain they wish to use into a Chain Signatures account the application can use. Users interact with the application using a single NEAR account and maintain full custody of their assets, even though they reside on another chain. Chain Signatures enables any NEAR account or smart contract to control and sign for an infinite number of accounts on any chain that exists today and chains that are yet to be launched! This is a major breakthrough for multichain Web3 application development, security, and UX.
Developing multichain Web3 applications with Chain Signatures:
Using Chain Signatures
Application logic is executed in NEAR smart contracts that produce signatures for accounts on any chain, executing transactions and moving assets. Shifting application logic upstream into a single layer of NEAR contracts reduces the developer’s burden of maintaining complex bespoke application smart contracts on each chain. Assets are still deployed as contracts on their respective chains, typically using standards and smart contract templates that are already audited, but application logic no longer needs to be.
With Chain Signatures, application logic can be in one place, one language, and on one layer; and hence only requires one smart contract audit. This facilitates a better developer experience, and in turn, a better and more secure user experience.
Let’s take a look at some examples of new and exciting applications that can be designed using Chain Signatures to better understand how this tech works.
Examples of Apps Unlocked by Chain Signatures
Multichain DAO
In crypto, users often want to pool funds and have an on-chain process for accepting proposals from the community and distributing those funds transparently. A decentralized autonomous organization (DAO) is generally the chosen approach for communities in Web3 today. Since Ethereum is the most widely accepted chain for popular stablecoins such as USDC, it makes sense to pool DAO funds there. However, running all of the DAO application logic using Ethereum smart contracts and transactions quickly becomes slow and cost-prohibitive, leading to voter apathy and disengagement.
Using Chain Signatures, one can develop a design that provides a more immediate and better user experience, while lowering fees significantly. In addition, there can be a single DAO application layer that accepts proposals and handles voting that distributes funds on multiple chains!
A Chain Signatures-powered DAO (high-level)
The DAO application logic is executed in a NEAR smart contract. Features such as membership, proposals, and voting are handled in the DAO contract. When a proposal is accepted, the DAO contract automatically calls the NEAR Chain Signatures contract to generate a signature for the derived address and account. This account exists on the chain where the DAO members originally pooled their funds. In the case of Ethereum, or any EVM chain, this can simply be an externally owned account (EOA) and does not require an additional smart contract to be deployed.
Multichain NFT Minter
Let’s imagine there’s a new NFT collection where the total supply is capped at 10,000, with one difference from the typical model: the collection will be minted across multiple chains. Without Chain Signatures, there are a few different ways to go about this.
- You have the primary sales logic and NFT logic deployed to each chain. This forces you to predetermine the amounts you will allow on each chain.
- This creates UX issues for users, who are forced to use a particular chain.
- This also imposes limitations on how your collection is minted.
- You have the primary sales logic on one chain and allow users to mint NFTs through a message-passing bridge to the chain of their choice.
- Introduces UX issues; multiple transactions and wallets for users.
- Adds bridging risks to the application and for user error.
- Primary sales logic and NFT mints are done on one chain and the NFTs are bridged after the fact.
- This introduces the above UX challenges and bridging risks.
- Allowing bridging means less control over the supply of NFTs on any particular chain.
The first approach is too rigid. The second and third require a minimum of 2 transactions from the user with all the complexity and security risks of bridging assets. Depending on your preference, you may or may not want users bridging your NFTs after the primary sale and initial mint. Let’s assume you don’t.
Let’s also assume you want a seamless sale experience, where the user chooses the chain of mint, and the NFT is minted to an existing wallet on an arbitrary chain. Ideally, all of this should occur in a single transaction for the user. Note, the price of gas can be rolled into the primary sale via an oracle.
Here’s how this would work with Chain Signatures:
A Chain Signatures Multichain NFT Mint (high-level)
The NFT Sale contract takes payment. This can be in NEAR, USDC, or any other token on NEAR. The NFT Sale contract calls the Chain Signatures contract with a transaction payload that mints an NFT on the destination chain selected by the user, and with an account as owner supplied by the user. A signature for the mint is generated, passed back to the user client, and then broadcasted to the selected chain. The NFT is minted on the selected chain’s NFT contract and ownership is given to the user’s account specified in the sale transaction. In a single transaction, an NFT is bought and minted on another chain.
Bitcoin Runes Airdrop
Bitcoin Runes are a new fungible token protocol by Ordinals creator Casey Rodarmor. Improving on BRC-20, Runes aim to produce less clutter and improve the costs of issuing and trading fungible tokens on Bitcoin. One drawback to Bitcoin is restricted programmability, making something like a mass Runes airdrop difficult. With Chain Signatures, NEAR can function as a smart contract layer for Bitcoin through which a mass Bitcoin Runes airdrop could be executed.
One can use a NEAR contract to maintain an “allow list” for the airdrop, utilizing a BTC light client contract. Assuming all the Runes are premined and residing in the Chain Signatures address derived from the NEAR Airdrop smart contract, the first step for the user is to fund this BTC address with the necessary BTC transaction fees to transfer the Runes to themselves. Once this is done, they can submit this transaction hash and their BTC address to the NEAR Airdrop contract, which will call the Chain Signatures contract with a transaction payload that will transfer the Runes.
Here’s what this would look like:
A Runes Airdrop using Chain Signatures (high-level)
The user funds the BTC address with the fees needed to transfer Runes to their account (1). They submit the transaction hash and their BTC address to the NEAR Airdrop contract (2). The NEAR Airdrop contract checks the user’s BTC address against the allow list. Then the contract calls the BTC Light Client to verify the fees have been paid (3). Finally, the NEAR Airdrop contract can generate a transaction to transfer the Runes to the user’s destination address. A cross-contract call is made to the Chain Signatures contract to sign the transaction. The signature is returned to the client and broadcasted to the Bitcoin network where the Runes are transferred (4).
Summary
NEAR Chain Signatures introduces a new way to design multichain Web3 applications for a range of use cases, such as DAOs, NFT minting, and airdrops. Chain Signatures brings rich smart contract functionality to non-smart contract chains like BTC and XRP. Building with Chain Signatures provides a better experience for developers and users. Developers have to write less smart contract code, submit fewer audits, and maintain fewer smart contract deployments across multiple chains. Users don’t have to bridge assets or perform several transactions in order to use the chains they feel most comfortable with. All in all, Chain Signatures is a massive step forward for multichain Web3 applications and towards mainstream adoption for new and existing crypto users.
NEAR Chain Signatures is live on testnet and will soon be available on mainnet. For further resources on Chain Signatures, see here. To get support for building with Chain Signatures, for any of the examples above or another idea, reach us here.
Disclosures: Proximity Labs holds $NEAR and other tokens or investments that may be associated with protocols or projects mentioned in this article. This article’s content does not constitute financial advice or a recommendation to buy, sell, or use any token or protocol. This article also contains forward-looking statements about third-party projects that the authors have no control over and, as such, actual future developments may be substantially different from the expectations described in the forward-looking statements for a number of reasons, including those that are not under the control of the authors. The content of this article reflects the opinions of its authors and is presented for informational purposes only. This is not and should not be construed to be investment advice.
Share this:
Join the community:
Follow NEAR: