The project won the Consensys Sponsorship Prize on the ETHSanFrancisco hackathon.
Created by HU Yao-Chieh, Lee Ting Ting, and Kevin Gau.
We built the CrossChain Swap environments for Bitcoin and Ethereum respectively. We implemented the mvp of the idea as a demo to visualize the BTC/ETH swapping process. Description on project deatils is available on Devpost with the Demo Video on Youtube
- Open Ethereum private node:
ganache-cli
- Open Bitcoin private node (after downloading bitcoin core):
bitcoind -txindex -regtest -reindex -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332
- Host the html site on port 9000:
serve-https /Users/tingtinglee/hack/WEB-v2-BTC/examples/swap/swap-e2e-local.html -p 9000
- In the browser, GOTO https://localhost:9000/examples/swap/_swap-e2e-local.html
- Fill in Bitcoin params: 100000 (or any)
- Click on Generate Secret
- Copy over Secret Hash to Bitcoin Initiate Swap
- Click on Initiate Swap
- Fill in Secret Hash at Ethereum Initiate Swap
- Click on Initiate Swap
- Fill in Secret from A
- Fill in Initiate Transaction Hash from B's Initiation on Ethereum
- Fill in Secret from A
- Fill in Initiate Transaction Hash from A's Initiation on Bitcoin
- A's BTC address: muWrnsfYwzv24sAuC1t45JssWttHUtA162
- A's ETH address: 0x5a3df33ebab91eb80712493c8ad30855b882c669
- B's BTC address: muT9jzX9Jws7X9xE6JZkXcNrzNAfQRDaj9
- B's ETH address: 0x1cdf3aac5329aa9d1dee420468a72bad24055885
bitcoind -txindex -regtest -reindex -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332
bitcoin-cli -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332 <function_name> <function_param>
bitcoin-cli -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332 getrawchangeaddress "legacy"
bitcoin-cli -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332 help
bitcoin-cli -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332 importprivkey cVuHNLamShn9pJEVQLy76fdzLPZxgfhenVdK7wo1vBweue4x2dHv
bitcoin-cli -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332 importprivkey cTYiTKhEujcjM4xqgzRHbpCc9Mbtpvqd8VpsRUB6aXygBgg5JsYp
bitcoin-cli -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332 generate 101
bitcoin-cli -rpcpassword=local321 -rpcuser=bitcoin -rpcport=18332 sendtoaddress muT9jzX9Jws7X9xE6JZkXcNrzNAfQRDaj9 10
bitcoin.getBalance(["muT9jzX9Jws7X9xE6JZkXcNrzNAfQRDaj9"]).then(console.log)
⚠️ This project is under heavy development. Expect bugs & breaking changes.
Query different blockchains with a single and simple interface.
npm install @liquality/chainabstractionlayer
Error: Cannot find module 'babel-runtime/core-js/get-iterator'
Issues to track: LedgerHQ/ledgerjs/issues/211, LedgerHQ/ledgerjs/issues/218
npm install babel-runtime
import { Client, providers } from '@liquality/chainabstractionlayer'
const { BitcoinRPCProvider } = providers.bitcoin
const bitcoin = new Client()
bitcoin.addProvider(new BitcoinRPCProvider('http://localhost:8080', 'bitcoin', 'local321'))
bitcoin
.generateBlock(1) // returns Promise
.then(console.log) // Array<BlockHash>
Chain | Wallet Provider | |
---|---|---|
Ethereum | Ledger | Source & Demo |
MetaMask | Source & Demo | |
Bitcoin | Ledger | Source & Demo |
The documentation is being generated by esdoc. Github Page hosted documentation is available at liquality.github.io/chainabstractionlayer
If you want to build documentation locally;
npm run build:docs