Skip to content

FluidTokens/ft-cardano-btc-eth-accounts

Repository files navigation

Aiken Smart Contracts for Bitcoin and Ethereum Wallet Integration

This repository contains smart contracts written in Aiken designed to integrate Bitcoin and EVM wallet signatures into the Cardano blockchain ecosystem.

Live demo

Try it on mainnet

Catalyst Closeout

This project was funded by Project Catalyst (Fund 12, project #1200046).

Validators Folder

  • The validators folder contains the Aiken smart contracts responsible for signature validation. These contracts allow compatibility with Bitcoin wallets and EVM wallets, leveraging their public key infrastructure for secure interaction within the Cardano blockchain.

  • btc.ak — contract to interact using Bitcoin wallets

  • eth.ak — contract to interact using EVM wallets

Project Flow

  1. Contract Address Generation:
    • The smart contract generates a Cardano-compatible address using the public key of a Bitcoin wallet. This address is then tied to that Bitcoin wallet for future operations.
image

In the image we can see an example of a contract address generated this way. You can identify it as a contract because its credentials match the plutus.json file generated by Aiken.

  1. Transaction Control:
    • The generated address can only perform specific actions like:
      • Sending assets
      • Delegating to stake pools
      • Withdrawing assets
    • These actions require the explicit approval of the Bitcoin wallet owner, done through an off-chain signature mechanism.

Here is an example transaction on explorer that allows staking delegation to a specific stake pool:

image

A Cardano wallet is able to submit the transaction using the signature provided by the Bitcoin wallet.

  1. Cross-Chain Authorization:

    • How does a Bitcoin wallet submit a transaction on Cardano? It doesn't.
      • Instead, the Bitcoin wallet signs an off-chain message, authorizing a specific transaction.
      • Once signed, anyone on Cardano can submit the corresponding transaction on behalf of the Bitcoin wallet, according to the contract owner's predefined rules, ensuring secure and transparent execution.
      • In exchange for submitting the transaction, the submitter is rewarded with a small fee in ADA.
  2. Compatible Wallets

Bitcoin Wallets

Wallet Website Supported Networks
XVerse https://xverse.app Bitcoin, Ordinals, Stacks
Unisat https://unisat.io Bitcoin, Ordinals
Leather https://leather.io Bitcoin, Ordinals
Magic Eden https://magiceden.io Bitcoin, Ethereum, Solana, Polygon
OKX https://www.okx.com Bitcoin, Ethereum, Solana, Avalanche, and more
image

Ethereum / EVM Wallets

eth.ak is compatible with Ethereum wallet signatures, allowing users to interact with Cardano using any EVM wallet.

Wallet Website Supported Networks
MetaMask https://metamask.io Ethereum, Optimism, Arbitrum, Polygon, and more
Magic Eden https://magiceden.io Ethereum, Polygon

Step by step guide

  • Clone the repository
  • Install Aiken
  • Generate the Cardano address for a Bitcoin wallet using the user's public key:
    aiken blueprint apply -v btc.btc.spend 028f5ced5649da371758f280635f94a558c68eee2ac4c7f07034425e97c60352bd
    
  • Use the signatures coming from the wallets — XVerse signMessage docs
  • Propagate the signed transaction using any Cardano wallet

Offchain Signature

The signature mechanism relies on an ECDSA signature of the user's intent. This is the standard on Bitcoin and is supported natively in Plutus via verify_ecdsa_secp256k1_signature.

More information: ECDSA on learnmeabitcoin.com

Key Features

  • Cross-chain integration: Bitcoin and EVM wallet signatures can authorize Cardano blockchain transactions.
  • Decentralized execution: Any Cardano user can submit pre-approved actions, reducing the burden on the wallet owner.
  • Small incentives: Users submitting authorized transactions earn a small ADA reward for their service.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages