Use cases for Chain Signatures
Chain signatures enable you to implement multichain and cross-chain workflows in a simple way. Lets take a look at a few possible use cases
Trade Blockchain assets without transactions
Trading assets across different blockchains usually require using a bridge that supports them, bringing longer settlement times as the trades are not atomic and require confirmation on both blockchains.
Using Chain signatures, you can trade assets across chains simply swapping the ownership of NEAR accounts that control funds on different blockchains. For example, you could trade a NEAR account that controls a Bitcoin account with X BTC
for another NEAR account that controls an Ethereum account with Y ETH
.
This way, you can keep native tokens on their native blockchain (e.g., BTC
on Bitcoin, ETH
on Ethereum, ARB
on Arbitrum) and trade them without bridges.
As an added bonus, trades are atomic across chains, settlement takes just 2 seconds, and supports any token on any chain.
There are transactions happening on different blockchains. The difference is that a Multi-Party Computation service (MPC) signs a transaction for you, and that transaction is then broadcast to another blockchain RPC node or API.
For example, a basic trade flow could be:
- Users create an account controlled by NEAR chain signatures
- Users funds these accounts on the native blockchains (depositing)
- Place orders by funding a new account for the total amount of the order
- Another user accepts the order
- Users swap control of the keys to fulfill the order
Details
- User A has
ETH
on the Ethereum blockchain, and wants to buy native Bitcoin - User B wants to sell Bitcoin for Ethereum
Steps
- User B, using NEAR, creates and funds a new account on Bitcoin with 1
BTC
- User B, using the spot marketplace smart contract, signs a transaction to create a limit order. This transfers control of the Bitcoin account to the smart contract
- User A creates a batch transaction with two steps
- Creating and funding a new Ethereum account with 10
ETH
- Accepting the order and atomically swapping control of the accounts
- Creating and funding a new Ethereum account with 10
- User A takes ownership of the Bitcoin account with 1
BTC
, and User B takes ownership of the Ethereum account with 10ETH
- User A and B can "withdraw" their asset from the order by transferring the assets to their respective "main" accounts
Oauth-controlled Blockchain accounts
On-boarding is a huge problem for decentralized applications. If you want widespread adoption you can't expect people to keep seed phrases safe in order to use an application.
An attractive way of managing Web3 accounts is to use existing Web2 accounts to on-board users. This can be done in the following way:
- Deploy a NEAR contract that allows the bearer of a user's JWT token to sign a blockchain transaction (Ethereum, Polygon, Avalanche, and others)
- The user validates their identity with a third-party receiving a JWT Token
- The user holding that token can interact with blockchain applications on Ethereum/Polygon/+++ via the NEAR contract for the duration of it's validity
Any method of controlling a NEAR account can also be used to control a cross-chain account.
JSON Web Tokens are a standard RFC 7519 method for representing claims securely between two parties. They are used in this example to represent the claim that someone is the owner of an Oauth account.
Cross-chain Zero-friction onboarding
Using unique features of the NEAR account model, Keypom provides zero-friction onboarding and transactions on NEAR. They are generally used for NFT drops, FT drops, and ticketing.
A generic Keypom user-flow could be:
- The developer creates a restricted NEAR account
- The account is funded with
NEAR
- The user receives a key with limited control of the account
- The user uses the funded account to call controlled endpoints on NEAR
- The user returns the remaining funds to the developer and their account is unlocked
This allows easy on-boarding to decentralized apps. The accounts are initially restricted to prevent the user being able to simply withdraw the NEAR
from the account.