Skip to content

Commit

Permalink
added landing pages for ca services
Browse files Browse the repository at this point in the history
  • Loading branch information
gagdiez committed Aug 8, 2024
1 parent 32b5ca6 commit d7b0746
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
id: chain-signatures-getting-started
title: Getting Started with Chain Signatures
hide_table_of_contents: true
---

Chain Signatures is a groundbreaking technology built on NEAR that enables NEAR accounts, including smart contracts, to sign and execute transactions across multiple blockchains. This innovation leverages Multi-Party Computation (MPC) and a distributed network of node operators to create joint signatures from arbitrary payloads, allowing NEAR users to control external blockchain accounts. This technology enhances blockchain interoperability, giving ownership of diverse assets, cross-chain accounts, and data to a single NEAR account.

---

## How Does It Work?

Chain Signatures operates through a series of steps to enable seamless cross-chain transactions:

1. **Deriving Foreign Addresses:**
* Chain Signatures uses derivation paths to represent accounts on foreign blockchains.
* The NEAR account’s name and the derivation path are used to mathematically [derive a unique address](https://docs.near.org/concepts/abstraction/chain-signatures\#derivation-paths-one-account-multiple-chains) for the user on the foreign blockchain.
2. **Creating the Transaction:**
* The client constructs the hash of the transaction to be signed, which varies by the target blockchain.
3. **Requesting the Signature:**
* A NEAR account or smart contract calls the sign method of the MPC smart contract ([v1.signer](https://nearblocks.io/address/v1.signer)) to sign a payload.
4. **Relaying the Signature:**
* The client reconstructs the valid transaction using the signature and broadcasts it to the destination blockchain.

This process eliminates the need for traditional bridges and enables developers to build innovative cross-chain DeFi applications with seamless user experiences.

---

## Use Cases

1. **DeFi on Bitcoin (and other chain without smart contracts)**
* Chain signatures allow NEAR smart contract to program assets on Bitcoin
* Build lending, swaps, runes launchpads, passkey-based Bitcoin wallets, and more
2. **Chain agnostic applications**
* Since chain signatures can sign transactions for all blockchains, developers can support every single chain with just one smart contract
* Multichain DEXs, lending protocols, oracles, derivatives, and more
3. **Multichain account abstraction**
* Users can control assets on all chains with just their NEAR account, and can utilize account abstraction features on any chain including passkeys, key rotation, etc
* Using the multichain gas relayer, users can pay for gas fees on any chain using USDC
4. **Privacy**
* Chain signatures can be used to encrypt and decrypt information in a programmatic way
* This enables privacy applications, and even decrypting information based on ownership of assets/NFTs

---

## How to Get Started?

1. **Familiarize Yourself with Chain Signatures:**
* Understand the [basics of Chain Signatures](https://docs.near.org/concepts/abstraction/chain-signatures) and how they simplify blockchain interactions.
* Review the technical [explainer](https://near.org/blog/unlocking-web3-usability-with-account-aggregation).
2. **Explore the Use Cases:**
* Review [examples of use cases for Chain Signatures](https://pages.near.org/blog/unlocking-multichain-web3-with-near-chain-signatures/), such as Multichain DAO, Multichain NFT Minter, and Bitcoin Runes Airdrop.
3. **Access Resources and Documentation:**
* Visit the [Chain Signatures documentation](https://docs.near.org/build/chain-abstraction/chain-signatures) for detailed technical information and code snippets.
* Check out the [Linktree for Chain Signatures](https://linktr.ee/chainsignatures) for various resources, including demos and tutorials.
4. **Try the Demos:**
* Use the [command-line-based demo](https://github.com/near-examples/chainsig-script) to derive accounts and send transactions on Bitcoin, Ethereum, Doge, and Ripple.
* Check out the [web app demo](https://github.com/near-examples/near-multichain/tree/main).
5. **Engage with the Community:**
* Join the [Chain Abstraction developers’ channel on Telegram](https://t.me/chain\_abstraction) to connect with other developers and get support.

---

## Where to Learn More?

To dive deeper into Chain Signatures and its applications, you can explore the following resources:

* **Technical Blogs and Deep Dives:**
* Read [high-level use cases](https://pages.near.org/blog/unlocking-multichain-web3-with-near-chain-signatures) and technical [explainer](https://near.org/blog/unlocking-web3-usability-with-account-aggregation) posts on the NEAR blog.
* **Community and Support:**
* Engage with the NEAR community on social media platforms like Twitter and participate in discussions to stay updated on the latest developments.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
id: getting-started
title: NEAR Multichain Gas Relayer - Getting Started Guide
hide_table_of_contents: true
---

The Multichain Gas Relayer provides gas abstraction for foreign chains outside of NEAR. This system, in conjunction with NEAR Chain Signatures, allows NEAR users to transact on other blockchains and pay for gas using NEAR, USDC, USDT, or other NEAR-based tokens from a single NEAR account. Chain Signatures lets users manage remote accounts and transact on any blockchain from a single NEAR account. The Multichain Gas Relayer further simplifies this process by eliminating the need for users to acquire native gas tokens to transact on other chains.

---

## Why did NEAR create the Multichain Gas Relayer?

NEAR's mission is to build blockchain infrastructure for Chain Abstracted applications. Chain abstraction aims to make blockchain technology more user-friendly by simplifying interactions. A key step in achieving this is reducing the complexity of paying for transaction gas across different blockchains. Users should be able to pay for cross-chain transactions with a single asset or have the gas fees fully sponsored on their behalf.

---

## How does it work?

The Multichain Gas Relayer has 3 core components:

1. **Gas Station Smart Contract**: A smart contract on NEAR that manages the creation, signing, of transactions to foreign chains. It also handles gas fee calculations and collects NEAR tokens for gas payments on foreign chains.
2. **Multichain Relayer Server**: This server coordinates the relaying of transactions between NEAR and other blockchains. It listens for signed transaction payloads and submits them to the appropriate foreign chain RPCs.
3. **Chain Signatures**: A network of distributed Multi-Party Computation (MPC) signers that cooperatively sign transactions. This ensures secure transaction signing and validation on the NEAR blockchain before relaying to foreign chains.

### System Workflow

1. **Transaction Creation**: Users initiate a transaction on NEAR, specifying the foreign chain transaction and attaching NEAR tokens to cover gas fees on the foreign chain. This transaction is sent to the Gas Station Contract.
2. **Transaction Signing**: The Gas Station Contract invokes Chain Signatures MPC signing service to sign the transaction. This step may require multiple calls due to gas limitations on NEAR, especially for complex transactions.
3. **Event Emission and Indexing**: Once the transactions are signed, the Gas Station Contract emits an event. The Gas Station Event Indexer picks up this event and triggers the Multichain Relayer Server to relay the signed transactions.
4. **Relaying Transactions**: The Multichain Relayer Server first sends a funding transaction to ensure the user’s account on the foreign chain has sufficient gas. Once confirmed, it sends the user’s originally intended signed transaction to the foreign chain for execution.

---

## Example Real-World Flow

* Alice has an alice.near account that maps to a remote Optimism (OP) address, 0xabc
* Alice wants to interact with a Farcaster application on OP using her NEAR account, but she prefers to pay for gas with assets she has on hand, specifically USDT
* Alice initiates an on-chain action on Farcaster from her NEAR account. She sends the transaction to a gas station smart contract, including the OP transaction payload in the arguments and attaching the necessary USDT amount for the cross-chain gas payment
* The transaction bundle is sent to the NEAR gas station contract, which then forwards it to the NEAR MPC signing service. This bundle includes (1) the transaction to fund the user's 0xabc address with the ETH needed for gas, and (2) the user's original transaction to take action on the Farcaster application
* The MPC service will sign both transactions and forward the signed transactions back to the gas station contract
* The relayer operator will observe the events (signed transactions) emitted from the gas station contract and submit them to the Optimism network. This process starts by initiating a fund transfer from a treasury paymaster account on Optimism that holds ETH. The paymaster account will transfer ETH to the user's 0xabc address, equivalent to the USDT originally sent by the user
* Then the relayer will submit the final transaction, and the originally intended Farcaster transaction will be executed from the user's 0xabc address, using ETH to cover the gas

---

## What chains are supported?

The NEAR Multichain Gas Relayer supports cross-chain gas abstraction on Base, Optimism, Arbitrum and Binance Smart Chain, and Ethereum. These chains were selected based on multiple factors including interest from key partners, low gas fees, and fast finality for transactions. Support for EDDSA chains like Solana will be coming soon in conjunction with EDDSA support for NEAR chain signatures.

---

## Where can I go to learn more?

* Visit our [docs](https://docs.near.org/build/chain-abstraction/multichain-gas-relayer/overview) to learn more about how to integrate the Multichain Gas Relayer into your product
* Join the NEAR Chain Abstraction [developer group](https://t.me/chain\_abstraction) on Telegram to ask questions and discuss ideas with other developers.
18 changes: 15 additions & 3 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,27 @@ const sidebar = {
]
},
{
"Chain Signatures": [
"type": "category",
"label": "Chain Signatures",
"link": {
"type": "doc",
"id": "build/chain-abstraction/chain-signatures-getting-started"
},
"items": [
"concepts/abstraction/chain-signatures",
'build/chain-abstraction/chain-signatures',
'build/chain-abstraction/nft-chain-keys',
]
},
// 'build/chain-abstraction/wallet',
{
"Multichain Gas Relayer": [
"type": "category",
"label": "Multichain Gas Relayer",
"link": {
"type": "doc",
"id": "build/chain-abstraction/multichain-gas-relayer/getting-started"
},
"items": [
"build/chain-abstraction/multichain-gas-relayer/overview",
"build/chain-abstraction/multichain-gas-relayer/gas-station",
"build/chain-abstraction/multichain-gas-relayer/multichain-server",
Expand Down Expand Up @@ -281,7 +293,7 @@ const sidebar = {
},
{
"Lake Framework": [
"concepts/advanced/near-lake-framework",
"concepts/advanced/near-lake-framework",
"build/data-infrastructure/lake-framework/near-lake",
"build/data-infrastructure/lake-framework/near-lake-state-changes-indexer",
"build/data-infrastructure/lake-framework/migrating-to-near-lake-framework",
Expand Down

0 comments on commit d7b0746

Please sign in to comment.