Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c4eb6d83a | ||
|
|
d4c2771f4a | ||
|
|
f64a8c8102 | ||
|
|
170bf0d120 | ||
|
|
049ae5de5c | ||
|
|
877d7762ff | ||
|
|
e0a0eed038 | ||
|
|
26692d6c92 | ||
|
|
68fd866894 | ||
|
|
d7216e1506 | ||
|
|
30c8bb2d94 | ||
|
|
17e9bd30c8 | ||
|
|
d47f03501d | ||
|
|
3d1abda05b | ||
|
|
de64f1c55a | ||
|
|
bcf87de2b4 | ||
|
|
ad1b1d3da4 | ||
|
|
a6f354600c | ||
|
|
647632c914 |
9
.github/workflows/push.yml
vendored
9
.github/workflows/push.yml
vendored
@@ -12,12 +12,7 @@ jobs:
|
||||
build:
|
||||
name: Build image
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v2
|
||||
@@ -49,6 +44,6 @@ jobs:
|
||||
docker buildx build \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||
--platform ${{matrix.platform}} \
|
||||
--platform linux/arm64,linux/amd64 \
|
||||
--tag ${{ secrets.DOCKER_CONTAINER_USERNAME }}/lndhub:$BRANCH \
|
||||
--output "type=registry" ./
|
||||
11
.github/workflows/tag.yml
vendored
11
.github/workflows/tag.yml
vendored
@@ -13,12 +13,7 @@ jobs:
|
||||
build:
|
||||
name: Build image
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v2
|
||||
@@ -49,7 +44,7 @@ jobs:
|
||||
docker buildx build \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||
--platform ${{matrix.platform}} \
|
||||
--platform linux/arm64,linux/amd64 \
|
||||
--tag ${{ secrets.DOCKER_CONTAINER_USERNAME }}/lndhub:$TAG \
|
||||
--output "type=registry" ./
|
||||
- name: Run Docker buildx
|
||||
@@ -57,6 +52,6 @@ jobs:
|
||||
docker buildx build \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||
--platform ${{matrix.platform}} \
|
||||
--platform linux/arm64,linux/amd64 \
|
||||
--tag ${{ secrets.DOCKER_CONTAINER_USERNAME }}/lndhub:latest \
|
||||
--output "type=registry" ./
|
||||
|
||||
@@ -23,6 +23,9 @@ Copy `admin.macaroon` and `tls.cert` in root folder of LndHub.
|
||||
`bitcoind` should run with `-deprecatedrpc=accounts`, for now. Lndhub expects Lnd's wallet to be unlocked, if not - it will attempt to unlock it with password stored in `config.lnd.password`.
|
||||
Don't forget to enable disk-persistance for `redis`.
|
||||
|
||||
If you have no `bitcoind` instance, for example if you use neutrino, or you have no bitcoind wallet,
|
||||
for example if you use LND for wallet managment, you can remove the bitcoind settings from `config.js`.
|
||||
Please not that this feature is limited to Bitcoin, so you can't use this feature if you use any other cryptocurrency with LND.
|
||||
|
||||
### Deploy to Heroku
|
||||
|
||||
@@ -31,6 +34,12 @@ Add config vars :
|
||||
* `MACAROON`: hex-encoded `admin.macaroon`
|
||||
* `TLSCERT`: hex-encoded `tls.cert`
|
||||
|
||||
### Run in docker
|
||||
|
||||
LndHub is available on Docker Hub as [`bluewalletorganization/lndhub`](https://hub.docker.com/r/bluewalletorganization/lndhub).
|
||||
Please note that this requires a separate instance of redis and LND and optionally, bitcoind.
|
||||
You can also view Umbrel's implementation using docker-compose [here](https://github.com/getumbrel/umbrel/blob/280c87f0f323666b1b0552aeb24f60df94d1e43c/apps/lndhub/docker-compose.yml).
|
||||
|
||||
### Reference client implementation
|
||||
|
||||
Can be used in ReactNative or Nodejs environment
|
||||
|
||||
@@ -412,7 +412,7 @@ export class User {
|
||||
amount: tx.amount,
|
||||
confirmations: tx.confirmations,
|
||||
address: tx.address,
|
||||
time: tx.time,
|
||||
time: tx.blocktime || tx.time,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -27,6 +27,7 @@ if (config.bitcoind) {
|
||||
console.error('bitcoind is not caught up');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('bitcoind getblockchaininfo:', info);
|
||||
} else {
|
||||
console.error('bitcoind failure:', err, info);
|
||||
process.exit(2);
|
||||
@@ -41,7 +42,7 @@ lightning.getInfo({}, function (err, info) {
|
||||
process.exit(3);
|
||||
}
|
||||
if (info) {
|
||||
console.info(info);
|
||||
console.info('lnd getinfo:', info);
|
||||
if (!info.synced_to_chain && !config.forceStart) {
|
||||
console.error('lnd not synced');
|
||||
// process.exit(4);
|
||||
@@ -109,6 +110,17 @@ subscribeInvoicesCall.on('end', function () {
|
||||
// The server has closed the stream.
|
||||
});
|
||||
|
||||
let lightningDescribeGraph = {};
|
||||
function updateDescribeGraph() {
|
||||
console.log('updateDescribeGraph()');
|
||||
lightning.describeGraph({ include_unannounced: true }, function (err, response) {
|
||||
if (!err) lightningDescribeGraph = response;
|
||||
console.log('updated graph');
|
||||
});
|
||||
}
|
||||
updateDescribeGraph();
|
||||
setInterval(updateDescribeGraph, 120000);
|
||||
|
||||
// ######################## ROUTES ########################
|
||||
|
||||
const rateLimit = require('express-rate-limit');
|
||||
@@ -489,6 +501,19 @@ router.get('/queryroutes/:source/:dest/:amt', async function (req, res) {
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/getchaninfo/:chanid', async function (req, res) {
|
||||
logger.log('/getchaninfo', [req.id]);
|
||||
|
||||
if (lightningDescribeGraph && lightningDescribeGraph.edges) {
|
||||
for (const edge of lightningDescribeGraph.edges) {
|
||||
if (edge.channel_id == req.params.chanid) {
|
||||
return res.send(JSON.stringify(edge, null, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
res.send('');
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
// ################# HELPERS ###########################
|
||||
|
||||
@@ -14,6 +14,7 @@ function updateLightning() {
|
||||
lightning.getInfo({}, function (err, info) {
|
||||
if (err) {
|
||||
console.error('lnd failure:', err);
|
||||
return;
|
||||
}
|
||||
lightningGetInfo = info;
|
||||
});
|
||||
@@ -23,6 +24,7 @@ function updateLightning() {
|
||||
console.error('lnd failure:', err);
|
||||
return;
|
||||
}
|
||||
console.log('updated');
|
||||
lightningListChannels = response;
|
||||
let channels = [];
|
||||
let max_chan_capacity = -1;
|
||||
@@ -47,7 +49,6 @@ function updateLightning() {
|
||||
} catch (Err) {
|
||||
console.log(Err);
|
||||
}
|
||||
console.log('updated');
|
||||
}
|
||||
updateLightning();
|
||||
setInterval(updateLightning, 60000);
|
||||
|
||||
@@ -512,25 +512,3 @@ Oauth2 process consists of such stages as:
|
||||
- Token service checks user id and secret and sends token data with refresh token to Authorization service which sends it to Client
|
||||
- Client uses token to access protected resources (GET ?access_token=XXXXXXXXXXXXXX)
|
||||
- When token expires or needs to refresh token for security issues Client sends refresh_token to Token service (POST /auth?type=refresh_token), which sends new token data with refresh_token and disables to access old
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
Добавил POST метод /addinvoice для того, чтобы пользователь мог создать свой инвойс
|
||||
в боди передаются параметы:
|
||||
{
|
||||
"amt": "string" обязательный
|
||||
"memo":"string" не обязательный
|
||||
"receipt":"string" не обязательный
|
||||
"preimage": "string" не обязательный
|
||||
"fallbackAddr": "string" не обязательны
|
||||
"expiry": "string" не обязательны
|
||||
"private": "string" не обязательны
|
||||
}
|
||||
|
||||
информация по инвойсам, которые оплатили пользователям досутпна через метод GET /getuserinvoices , полученные коины учитываются в балансе (settled в unconfirmed balance, остальной в confirmed balance)
|
||||
|
||||
```
|
||||
|
||||
@@ -28,7 +28,7 @@ User storage schema
|
||||
* metadata_for_{userid}= {serialized json}
|
||||
* userinvoices_for_{userid} = []
|
||||
* payment_hash_{payment_hash} = {userid}
|
||||
* ispaid_{payment_hash} = 1
|
||||
* ispaid_{payment_hash} = {settleAmountSat}
|
||||
|
||||
|
||||
####cleanup test user
|
||||
@@ -36,4 +36,5 @@ User storage schema
|
||||
* del locked_payments_for_666
|
||||
* del txs_for_666
|
||||
* del invoice_paying_for_666
|
||||
* del userinvoices_for_666
|
||||
* del userinvoices_for_666
|
||||
* del balance_for_666
|
||||
8453
package-lock.json
generated
8453
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lndhub",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.2",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -13,17 +13,17 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/cli": "^7.13.0",
|
||||
"@babel/core": "^7.13.1",
|
||||
"@babel/eslint-parser": "^7.13.4",
|
||||
"@babel/core": "^7.13.8",
|
||||
"@babel/eslint-parser": "^7.13.10",
|
||||
"@babel/node": "^7.13.0",
|
||||
"@babel/preset-env": "^7.13.5",
|
||||
"@babel/register": "^7.13.0",
|
||||
"@grpc/grpc-js": "^1.2.8",
|
||||
"@grpc/proto-loader": "^0.5.6",
|
||||
"@babel/preset-env": "^7.13.9",
|
||||
"@babel/register": "^7.13.8",
|
||||
"@grpc/grpc-js": "^1.2.10",
|
||||
"@grpc/proto-loader": "^0.6.0",
|
||||
"bignumber.js": "^9.0.1",
|
||||
"bitcoinjs-lib": "^5.2.0",
|
||||
"bolt11": "^1.2.7",
|
||||
"core-js": "^3.9.0",
|
||||
"bolt11": "^1.3.1",
|
||||
"core-js": "^3.9.1",
|
||||
"eslint": "^7.20.0",
|
||||
"eslint-config-prettier": "^8.0.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
|
||||
@@ -143,7 +143,7 @@ lightning.listChannels({}, function (err, response) {
|
||||
'--connect',
|
||||
important_channels[important].uri.split('@')[1],
|
||||
'--local_amt',
|
||||
important_channels[important].wumbo ? '50000000' : '16777215',
|
||||
important_channels[important].wumbo ? '100000000' : '16777215',
|
||||
'--remote_csv_delay 144',
|
||||
'--sat_per_byte 10',
|
||||
'#',
|
||||
|
||||
25
scripts/migrate_addresses_to_other_bitcoind.sh
Normal file
25
scripts/migrate_addresses_to_other_bitcoind.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
# this script should be used if youre retiring one bitcoind in favor of new one
|
||||
# it exports all addresses from the old one and prepares script to import them on a new node
|
||||
#
|
||||
echo export 1...
|
||||
./bitcoin-0.21.0/bin/bitcoin-cli -rpcwallet="" -rpcconnect=1.1.1.1 -rpcuser=user -rpcpassword=oldPassword listreceivedbyaddress 0 true true > addresses.txt
|
||||
echo export 2...
|
||||
./bitcoin-0.21.0/bin/bitcoin-cli -rpcwallet="wallet.dat" -rpcconnect=1.1.1.1 -rpcuser=user -rpcpassword=oldPassword listreceivedbyaddress 0 true true >> addresses.txt
|
||||
|
||||
echo clean...
|
||||
cat addresses.txt | grep address | sort -u | awk '{print $2}' | sed 's/"//g' | sed 's/,//g' > addresses_clean.txt
|
||||
|
||||
echo "got addresses:"
|
||||
wc -l < addresses_clean.txt
|
||||
|
||||
|
||||
echo writing import_on_other_node.sh ...
|
||||
>import_on_other_node.sh
|
||||
chmod +x import_on_other_node.sh
|
||||
|
||||
while read in; do
|
||||
echo "./bitcoin-0.21.0/bin/bitcoin-cli -rpcconnect=2.2.2.2 -rpcuser=user -rpcpassword=newPassword importaddress $in $in false" >> import_on_other_node.sh
|
||||
done < addresses_clean.txt
|
||||
|
||||
echo 'done. dont forget to run ./import_on_other_node.sh and then ./bitcoin-0.21.0/bin/bitcoin-cli -rpcconnect=2.2.2.2 -rpcwallet="wallet.dat" -rpcuser=user -rpcpassword=newPassword rescanblockchain 459491'
|
||||
|
||||
@@ -112,8 +112,10 @@ body {
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
max-width : 100%;
|
||||
max-width: 100%;
|
||||
-webkit-appearance: none;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
#progressbar[max]::-webkit-progress-value {
|
||||
border-radius: 8px 4px 4px 8px;
|
||||
|
||||
Reference in New Issue
Block a user