NEAR Chain Signatures Integration
NEAR Chain Signatures is fundamentally different approach to cross-chain interaction. Instead of specialized bridge contracts on each chain, Chain Signatures allow NEAR account to sign transactions for any chain: Ethereum, Bitcoin, Solana, Dogecoin — without deploying anything.
How It Works
Behind: MPC (Multi-Party Computation) network of NEAR validators collectively holding master key. User requests transaction signature for another chain, MPC network generates signature via threshold cryptography. Result is valid signature for target chain that can be broadcast.
One NEAR account controls Bitcoin address, Ethereum address, Solana address — without seed phrase for each. Single NEAR account = access to all assets.
Derivation Paths
Each NEAR account can get multiple addresses on external chains via derivation path:
// alice.near with path "eth-1" → one ETH address
// alice.near with path "eth-2" → another ETH address
// alice.near with path "btc-main" → BTC address
One NEAR account manages multiple wallet addresses on different chains.
Requesting Signature
import { connect, utils } from "near-api-js";
async function requestEthSignature(
nearAccount: Account,
ethTxPayload: string,
derivationPath: string
): Promise<{ r: string; s: string; v: number }> {
const result = await nearAccount.functionCall({
contractId: "v1.signer.near", // MPC contract
methodName: "sign",
args: {
payload: Array.from(Buffer.from(ethTxPayload, "hex")),
path: derivationPath,
key_version: 0,
},
gas: "300000000000000",
attachedDeposit: utils.format.parseNearAmount("0.1"),
});
const { big_r, s, recovery_id } = result as any;
return {
r: big_r.affine_point,
s: s.scalar,
v: recovery_id,
};
}
Full Flow: NEAR → Ethereum Transaction
import { ethers } from "ethers";
async function sendEthFromNear(
nearAccount: Account,
recipient: string,
amountWei: bigint,
derivationPath: string
) {
// 1. Get Ethereum address
const ethAddress = await getEthAddressFromNear(nearAccount, derivationPath);
// 2. Get nonce and gas price
const provider = new ethers.JsonRpcProvider("https://eth.llamarpc.com");
const nonce = await provider.getTransactionCount(ethAddress);
const feeData = await provider.getFeeData();
// 3. Create unsigned transaction
const tx = {
to: recipient,
value: amountWei,
nonce,
chainId: 1,
maxFeePerGas: feeData.maxFeePerGas,
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas,
gasLimit: 21000n,
type: 2,
};
// 4. Serialize for signature
const serialized = ethers.Transaction.from(tx).unsignedSerialized;
const payload = ethers.getBytes(ethers.keccak256(serialized));
// 5. Request signature from MPC via NEAR
const signature = await requestEthSignature(
nearAccount,
Buffer.from(payload).toString("hex"),
derivationPath
);
// 6. Build signed transaction
const signedTx = ethers.Transaction.from({
...tx,
signature: {
r: "0x" + signature.r,
s: "0x" + signature.s,
v: signature.v,
},
});
// 7. Broadcast to Ethereum
const txResponse = await provider.broadcastTransaction(signedTx.serialized);
return txResponse.wait();
}
Bitcoin Integration
Chain Signatures supports Bitcoin natively (secp256k1 + P2WPKH/P2TR).
Use Cases
Omnichain DeFi. dApp on NEAR, manage positions on Ethereum AAVE, Uniswap without bridge.
Cross-chain liquidation bot. Monitor positions on multiple chains, auto-liquidate using signatures.
Multi-chain portfolio management. Manage assets on Ethereum, Bitcoin, Solana from one NEAR account.
Atomic swaps without bridge. ETH ↔ BTC with on-chain HTLC guarantees.
Limitations
Chain Signatures relatively new (mainnet 2024). Maturity lower than Axelar/LayerZero. MPC latency: signature takes 3-5 seconds. Cost: ~0.1 NEAR + gas per sign.
Stack: React + near-api-js, NEAR contracts (Rust/TypeScript), ethers.js/bitcoinjs-lib/@solana/web3.js.
Timelines: NEAR + Chain Signatures basic flow — 2-3 weeks. Ethereum integration — +1-2 weeks. Bitcoin — +2-3 weeks. Full omnichain dApp — 2-3 months.







