Giter Site home page Giter Site logo

fastbtc's Introduction

Fast-Btc-Relay

Relays Btc to RBtc. For every RBtc address provided by the user a BTC deposit addresses (p2wsh/p2ms) is generated from a multisig hd wallet (bip32). A smart contract on Rsk provides RBtc which can be withdrawn from an authorized admin wallet. A watcher is listening 24h-7 for incoming transactions on all created Btc deposit addresses. If a new transaction is detected the admin wallet credits the same amount on the users Rsk wallet address minus a small provision. A sqlite database keeps track of the deposits and withdrawals. Improvements:

  • Include automated Btc->RBtc conversion via 2WP.
  • Eliminate trust on BTC deposits by integrating atomic swaps with the smart contract as counterparty.
  • Improve security: the higher the amount the more confirmations should be waited for.

Requirements

NodeJs > 13.1
Nodemon
Webpack

Install

1. npm install
2. npm run build-client
3. Create empty directories "logs", "secrets" and "db"
4. Within "secrets" a file accounts.js with the credentials of the admin wallet

export default {
    "test": {
        adr: "0x..."
        pKey: ""
    },
    "main": {
        adr: "0x..."
        pKey: ""
    }
}

and telegram.js for telegram notifications on successful deposits/withdraws and errors

export default {
    infoBotToken: "...",
    errorBotToken: "..."
}
  
walletSigs.main.js for the multisigs hd wallet  
  
export default {
    pubKeys: [
        "pub-key1",
        "pub-key2",
        "pub-key3"
    ]
}

To generate the keys run "npm run [genAdminTestnet | genAdminMainnet]" 3 times. Paste the 12 words from first output to "myWordSeed" and xpub from second output to pub-key1 and xpub from third output to pub-key2. 

and cryptocompare.js for btc price polling

export const apiKey = "...";

5. Set the block number of Btc test- or mainnet on config/store.json from which polling should start
{
	"lastBlockNumber": 1897463
}

Start

npm run start

Check the frontend at http://your-ip:port/

Withdraw from Btc multisig

  1. Make sure the database in db/ is up-to-date and matches the name in the config file,
  2. Add a receiver address on utils/withdrawBtc.js on line 7
  3. Change the gasPrice on line 8 (optional)
  4. Add the 12 seed words from one of the 3 accounts on line 9 and the private key of the second account on line 10,
  5. then execute:
npm run [withdrawBtcMainnet | withdrawBtcTestnet]

Withdraw from the smart contract on Rsk

  1. Set the receiver in utils/withdrawRsk.js on line 6
  2. In case you are the admin you are done, in case you are the contract owner: add your private key and wallet address on line 8 and 9 and change the contract call from "withdrawAdmin" to "withdraw" on line 21
  3. Specify the amount on line 5,
  4. then execute
npm run [withdrawRskMainnet | withdrawRskTestnet]

Control the database

Sqlite commandline tool: type sqlite3 in the shell, ctrl+d to exit

License

MIT Free Software, Hell Yeah!

fastbtc's People

Contributors

jamiemadrox779 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.