aboutsummaryrefslogtreecommitdiffstats
path: root/zmq.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-07-31 01:04:16 -0700
committerAdam Soltys <[email protected]>2026-07-31 01:04:16 -0700
commitec42b8be8ec4ff697e72f765e023db9741f7adef (patch)
tree8663906da974657780ba726b48d3c1e7052fec12 /zmq.js
parent60f9c91b61ce069fb472369eb6c16bf1a984a3d6 (diff)
downloadcoinos-server-ec42b8be8ec4ff697e72f765e023db9741f7adef.tar.gz
coinos-server-ec42b8be8ec4ff697e72f765e023db9741f7adef.zip
mintdemux: transparent two-mint proxy for mint.coinos.io
Front the current mint (fresh keys, normal ops) as primary, and transparently route pre-shutdown ecash melts to the retired panic-mode mint so wallets can melt old ecash at mint.coinos.io without changing their URL: - /v1/keysets is the union of both mints' keysets - /v1/keys/<id> and melt execute route by the keyset owner - a melt quote is taken on the primary and the invoice remembered, so an old-keyset melt is re-quoted and executed on the recovery mint (where panic mode gates blacklisted funds) - /v1/checkstate is merged across both; CORS added for web wallets The recovery mint also stands alone at mintrecovery.coinos.io.
Diffstat (limited to 'zmq.js')
0 files changed, 0 insertions, 0 deletions
.highlight .w { color: #BBB } /* Text.Whitespace */ .highlight .mb { color: #00D; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #00D; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #00D; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #00D; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #00D; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #D20; background-color: #FFF0F0 } /* Literal.String.Affix */ .highlight .sb { color: #D20; background-color: #FFF0F0 } /* Literal.String.Backtick */ .highlight .sc { color: #D20; background-color: #FFF0F0 } /* Literal.String.Char */ .highlight .dl { color: #D20; background-color: #FFF0F0 } /* Literal.String.Delimiter */ .highlight .sd { color: #D20; background-color: #FFF0F0 } /* Literal.String.Doc */ .highlight .s2 { color: #D20; background-color: #FFF0F0 } /* Literal.String.Double */ .highlight .se { color: #04D; background-color: #FFF0F0 } /* Literal.String.Escape */ .highlight .sh { color: #D20; background-color: #FFF0F0 } /* Literal.String.Heredoc */ .highlight .si { color: #33B; background-color: #FFF0F0 } /* Literal.String.Interpol */ .highlight .sx { color: #2B2; background-color: #F0FFF0 } /* Literal.String.Other */ .highlight .sr { color: #080; background-color: #FFF0FF } /* Literal.String.Regex */ .highlight .s1 { color: #D20; background-color: #FFF0F0 } /* Literal.String.Single */ .highlight .ss { color: #A60; background-color: #FFF0F0 } /* Literal.String.Symbol */ .highlight .bp { color: #038 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #06B; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #369 } /* Name.Variable.Class */ .highlight .vg { color: #D70 } /* Name.Variable.Global */ .highlight .vi { color: #33B } /* Name.Variable.Instance */ .highlight .vm { color: #369 } /* Name.Variable.Magic */ .highlight .il { color: #00D; font-weight: bold } /* Literal.Number.Integer.Long */
#!/bin/bash

sats=100000000
threshold=$1
while true
do
  ln=$(lncli --lnddir=/root/.lnda --network=mainnet --chain=bitcoin --rpcserver=localhost:10001 channelbalance | jr .balance)
  bc=$(bitcoin-cli getbalance)
  el=$(elements-cli getbalance | jr .bitcoin)
  total=$(node -pe "$ln + $bc * $sats + $el * $sats")
  low=$(node -pe "$total < $threshold")
  echo $(date -Is) ln $ln bc $bc el $el tot $total
  if "$low"; then 
    echo "Threshold hit, setting new threshold"
    threshold=$total
    # yarn pm2 stop 0 > /dev/null
   node /root/mailgun/index.js
  fi
  sleep 10 
done