Service that will swap rbtc for btc and then initiated a loopin through lnd-loop

Overview

Code

RSK balances

TODO

  • 2fa authenticator
  • write operations (update balancer configuration, update&restart boltz??)
  • dockerization
  • add more docs
  • add more tests

Swagger UI

Description

This service main purpose is to be a "balancing" tool for lnsov bridge.
The lnsov bridge is an exchange that offers rbtc / lightning swaps. It should maintain ~50% of funds in lightning wallet and 50% funds in rsk wallet.
It uses lightning loop service to do either:

  • loop in
    • when lightning balance falls below X%
      1. this service sends funds from rsk wallet to RSK federation address
      2. after 100 confirmations RSK federation address sends funds to "rsk-paired" bitcoin wallet
      3. this service is monitoring "rsk-paried" bitcoin address for new transactions
      4. after new transaction is found it sends it to lightning wallet
      5. after funds arrive to lightning wallet it initiates a loop in
  • loop out
    • when RBTC balance falls below X%
      1. this service initiates a loop out
      2. loop out service sends funds to our lightning wallet
        • it is possible to loop out to specific bitcoin address, so by modfying step1, we might skip straight to step4 and save 1 onchain transaction
      3. this service monitors loop service for loop SWAP status,
      4. when swap status=COMPLETE it sends onchain transaction to "rsk-paired" bitcoin wallet
      5. this service sends coins from "rsk-paired" wallet to RSK-Federation address
      6. after 100 confirmations funds are available in RSK wallet

Before running

  1. unlock lnd wallet you are connecting to (lncli unlock)
  2. load new account to bitcoind
    • bitcoin-cli -chain=test -rpcpassword=password -rpcuser=rpcuser createwallet boltz-testnet-btc-wallet
    • bitcoin-cli -chain=test -rpcpassword=password -rpcuser=rpcuser loadwallet boltz-testnet-btc-wallet Verify by:
      • bitcoin-cli -chain=test -rpcpassword=qqqwwweeerrrtttooo -rpcuser=kristjan1234 listwallets
        • ["boltz-testnet-btc-wallet"]
  3. start loop client -eg: ./loopd --network=testnet --lnd.macaroonpath=/var/lib/docker/volumes/bitcoind-lnd_bitcoin/_data/data/chain/bitcoin/testnet/admin.macaroon --lnd.tlspath=/var/lib/docker/volumes/bitcoind-lnd_bitcoin/_data/tls.cert --tlsextraip=185.217.125.196 --restlisten=185.217.125.196:8081
    1. Java stuff
      1. make sure you have java11, then run mvn package -Dmaven.test.skip=true
      2. go to cd target
      3. start with java jar btc-rbtc-swapper-0.0.1-SNAPSHOT.jar -DRSK_SERVICE_URL=URL etc... etc. example:
          java \
          -DRSK_BRIDGE_ADDRESS=some_value \
          -DRSK_WALLET_PRIVATE_KEY=some_value \
          -DRSK_WALLET_PUBLIC_KEY=some_value \
          -DRSK_SERVICE_URL=https://public-node.testnet.rsk.co \
          -DBTC_SERVICE_URL=some_value \
          -DBTC_RPC_COOKIE=some_value \
          -DLND_WALLET_ADDRESS= \
          -DLND_LOOP_URL=some_value \
          -DLND_LOOP_ADMIN_MACAROON=some_value \
          -DBTC_WALLET_PRIVATE_KEY=some_value \
          -DBTC_WALLET_PUBLIC_KEY=some_value \
          -DLND_ADMIN_MACAROON=some_value \
          -DLND_URL=some_value \
          -jar target/btc-rbtc-swapper-0.0.1-SNAPSHOT.jar

This service requires access to the following information:

# RSK NODE URL FOR MONITORING RSK CHAIN AND SENDING TRANSACTIONS
rsk.service.url=${RSK_SERVICE_URL}
# RSK WALLET PUBLIC ADDRESS FOR MONITORING BALANCE AND CHECKING FOR NEW TRANSACTIONS
rsk.wallet.public.key=${RSK_WALLET_PUBLIC_KEY}
# RSK WALLET PRIVATE KEY FOR SENDING TRANSACTIONS TO RSK-BRIDGE-CONTRACT
rsk.wallet.private.key=${RSK_WALLET_PRIVATE_KEY}

# RSK BRIDGE CONTRACT FOR COINS TO BE SENT TO
# mainnet RSK Bridge Contract address: 0x0000000000000000000000000000000001000006
# https://developers.rsk.co/rsk/rbtc/conversion/networks/mainnet/
# testnet 0x0000000000000000000000000000000001000006
# https://developers.rsk.co/rsk/rbtc/conversion/networks/testnet/
rsk.bridge.address=${RSK_BRIDGE_ADDRESS} 

# BITCOIN NODE URL FOR MONITORING BTC CHAIN AND SENDING TRANSACTIONS
btc.service.url=${BTC_SERVICE_URL}
# USER/PW OR COOKIE VALUE FOR COMMUNICATION WITH BITCOIN NODE
btc.rpc.cookie=${$BTC_RPC_COOKIE}
# BITCOIN WALLET PUBLIC ADDRESS FOR MONITORING FOR NEW TRANSACTIONS
# IT SHOULD BE DERIVED FROM RSK_PUBLIC_KEY
# https://github.com/rsksmart/utils
# https://developers.rsk.co/rsk/rbtc/conversion/networks/mainnet/
btc.wallet.public.key=${RSK_WALLET_PUBLIC_KEY}
btc.wallet.private.key=${RSK_WALLET_PRIVATE_KEY}

# LIGHTNING WALLET ONCHAIN ADDRESS TO SEND FUNDS BEFORE LOOP IN
lnd.wallet.address=${LND_WALLET_ADDRESS}

# LND LOOP HTTP API ENDPOINT FOR INITIAING LOOPIN/LOOPOUT
lnd.loop.url=${LND_LOOP_URL}
# ADMIN MACAROON GENERATED BY LOOP CLIENT, IN HEX VALUE
# COMMAND: xxd -p -c2000 ~/.loop/testnet/loop.macaroon
# https://github.com/lightningnetwork/lnd/issues/2951
lnd.loop.admin.macaroon=${LND_LOOP_ADMIN_MACAROON}

Helpful information

RSK

BTC

Multiple databases:

testtest

You might also like...

Project developed in Block 1 through the Generation bootcamp

Project developed in Block 1 through the Generation bootcamp

PROJETO JAVA - CCHIV COMBATE CONTRA O HIV COMO SURGIU ? É um software criado para facilitar a forma de atender o público de pessoas portadoras do HIV

Jul 5, 2022

The application consists of a web page with a list of some movies. The page allows user interaction through ratings of movies listed in the web app.

The application consists of a web page with a list of some movies. The page allows user interaction through ratings of movies listed in the web app.

DSMovie About the project https://matheus-maia-alvarez-dsmovie.netlify.app/ DSMovie is a full stack web and mobile application built during the Spring

Jul 21, 2022

A custom minimap that displays resources all around you while you adventure through Aeternum!

A custom minimap that displays resources all around you while you adventure through Aeternum!

New-World-MiniMap A custom minimap that displays resources all around you while you adventure through Aeternum! Download Download Page Minimap.rar Oth

Dec 9, 2021

An extension that wraps a Cellpose environment such that WSI can be analyzed using Cellpose through QuPath.

An extension that wraps a Cellpose environment such that WSI can be analyzed using Cellpose through QuPath.

QuPath Cellpose extension This repo adds some support to use 2D Cellpose within QuPath through a Python virtual environment. Installing Step 1: Instal

Nov 25, 2022

Winfoom is an HTTP(s) proxy server facade that allows applications to authenticate through the proxy without having to deal with the actual handshake.

Winfoom is an HTTP(s) proxy server facade that allows applications to authenticate  through the proxy without having to deal with the actual handshake.

winfoom Basic Proxy Facade for NTLM, Kerberos, SOCKS and Proxy Auto Config file proxies To help this project please give it a star ⭐ Overview Winfoom

Dec 8, 2022

Simple and extensible identity management service

AuthGuard An easy-to-use, and easy-to-customize, identity server. It supports multiple authentication and authorization options and can be extended to

Jan 9, 2022

Lightweight service-based PubSub, RPC and public APIs in Java

kite - service-based RPC, public APIs and PubSub in Java kite is a collection of reactive application messaging libraries that aim at providing high l

Feb 17, 2022

SpringBoot service to pick up CAN messages retransmitted by CANBridge and extract certain values for reporting/monitoring/alerting via DataDog

SpringBoot service to pick up CAN messages retransmitted by CANBridge and extract certain values for reporting/monitoring/alerting via DataDog

SpringBoot service to pick up CAN messages retransmitted by CANBridge and extract certain values for reporting/monitoring/alerting via DataDog

Mar 12, 2022

Spring REST service built with Spring initializr and Spring Data.

Spring REST Service Generated with start.spring.io, using Spring Data. Documented using Spring REST Docs. Spring Initializr - Generate new Spring Rest

Jan 28, 2022
Owner
Kris
Software engineer
Kris
A script that downloads wallpapers from the subreddit r/wallpapers and then sets them on your Windows machine.

Wallpaper Downloader ?? This script takes the most voted wallpaper in the subreddit r/wallpapers in 24 hours, downloads the .json of that page, parses

404a10 1 May 15, 2022
Java For-each Loop

Java-For-each-Loop Java For-each Loop Watch basic code using following link: https://github.com/JehanKandy/First-Coding-with-JAVA code Explain publi

JehanKandy 8 Jul 13, 2022
Desafio final do camp "IBM- If Black, Then Code"

[IBM- If Black, Then Code] Desafio Final - Hello Bank ?? Objetivo O desafio final consiste em desenvolver API REST resolvendo a funcionalidade de tran

Lucas Pontes 3 Sep 12, 2022
Tasks Planner : A minimalist collaborative app for scheduling and managing your tasks with the team and getting notifications through discord.

Tasks Planner ✨ Overview Tasks planner is a minimalist collaborative app for planning and managing your tasks with the team and get notifications thro

MILIARI Adnane 7 Dec 1, 2022
This project uses the artificial potential field method to realize the path planning of the robot, and completes the trajectory optimization through other settings. It can also be combined with laser SLAM, target recognition and other technologies for path planning.

FRCAutoDriver 项目说明 Project Instruction 本项目利用人工势场法,实现机器人的路径规划,并通过其他设置完成轨迹优化,还可以结合激光SLAM、目标识别等技术进行路径规划 This project uses the artificial potential field

ZhangzrJerry 2 Sep 9, 2022
DM Movie is an app with several movies catalogued through a database, you enter your email and your rating of the movie

DM Movie is an app with several movies catalogued through a database, you enter your email and your rating of the movie

Davi M. G. de Almeida 5 Jan 28, 2022
An AI companion who is eager to learn and would love to see the world through your eyes. Gedir is always ready to chat when you need an empathetic friend

Gedir We are currently developing the core. Ideas, feedback, and contributions to code are all very welcome. An AI companion who is eager to learn and

SZ 3 Sep 3, 2022
Log4j CVE-2021-44228 examples: Remote Code Execution (through LDAP, RMI, ...), Forced DNS queries, ...

Log4j CVE-2021-44228 and CVE-2021-45046 Requisites Use a vulnerable JDK, for instance JDK 1.8.0_181 Usage Malicious server The malicious server deploy

Manuel Álvarez Álvarez 5 Feb 7, 2022
Xerath - 🔪 AOP development framework implemented through *Annotation + ASM + Gradle Transform API* for Android🤖

简体中文 | English | Xerath Xerath 是一个通过 [自定义注解]+ASM + Gradle Transform API 实现的一套功能强大,方便开发,并且能够有效减少重复代码的Android Aop 框架。 旨在编译器进行全局性的修改,来完成一些诸如方法耗时统计,异常收集,拦

Pumpkin 325 Nov 22, 2022
ijrd - internal java runtime debugger (loads through java agents LOL)

ijrd ijrd - internal java runtime debugger (loads through java agents LOL) this actually requires brain to build and then setup little guide to setup

null 6 Jan 28, 2022