chGoodchild / GLTollGate

6 stars 2 forks source link

Paid successfully, but connection is rejected #51

Closed chGoodchild closed 2 months ago

chGoodchild commented 2 months ago
root@OpenWrt:/www/cgi-bin# cat /tmp/arguments_log.md 
METHOD: auth_client, MAC: 28:d2:44:64:f1:f7, USERNAME: cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6IjlkNTBhMjAyZWVkZjljNmJkZTE5ZjNiOTVkMDg1ZjFhZjVkMDQyMTllYTAzNWNiNGY5MWJmY2Y5OTg3MTU1YmUiLCJDIjoiMDI1NzZiNzM3NmU2YjFjZDA0ZDNhODU2NjM0MGIwOTBmZjRlMWI2YTBhNmFlMGQwYWE5NzBhYzY4MDcyNTJkMjdiIn1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0, PASSWORD: 
Auth Client - ECASH: cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6IjlkNTBhMjAyZWVkZjljNmJkZTE5ZjNiOTVkMDg1ZjFhZjVkMDQyMTllYTAzNWNiNGY5MWJmY2Y5OTg3MTU1YmUiLCJDIjoiMDI1NzZiNzM3NmU2YjFjZDA0ZDNhODU2NjM0MGIwOTBmZjRlMWI2YTBhNmFlMGQwYWE5NzBhYzY4MDcyNTJkMjdiIn1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0
Curl request - ECASH: 
Redeem token response: {
  "paid": true,
  "preimage": "",
  "change": [],
  "total_amount": 64
}
Curl request - ECASH: cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6IjlkNTBhMjAyZWVkZjljNmJkZTE5ZjNiOTVkMDg1ZjFhZjVkMDQyMTllYTAzNWNiNGY5MWJmY2Y5OTg3MTU1YmUiLCJDIjoiMDI1NzZiNzM3NmU2YjFjZDA0ZDNhODU2NjM0MGIwOTBmZjRlMWI2YTBhNmFlMGQwYWE5NzBhYzY4MDcyNTJkMjdiIn1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0, Exit Code: 0
Redeem response: + MINT_URL=https://mint.minibits.cash/Bitcoin
+ LNURL=https://minibits.cash/.well-known/lnurlp/chandran
+ TOKEN=cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6IjlkNTBhMjAyZWVkZjljNmJkZTE5ZjNiOTVkMDg1ZjFhZjVkMDQyMTllYTAzNWNiNGY5MWJmY2Y5OTg3MTU1YmUiLCJDIjoiMDI1NzZiNzM3NmU2YjFjZDA0ZDNhODU2NjM0MGIwOTBmZjRlMWI2YTBhNmFlMGQwYWE5NzBhYzY4MDcyNTJkMjdiIn1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0
+ VERBOSE=false
+ '[' -z cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6IjlkNTBhMjAyZWVk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Olt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6IjlkNTBhMjAyZWVkZjljNmJkZTE5ZjNiOTVkMDg1ZjFhZjVkMDQyMTllYTAzNWNiNGY5MWJmY2Y5OTg3MTU1YmUiLCJDIjoiMDI1NzZiNzM3NmU2YjFjZDA0ZDNhODU2NjM0MGIwOTBmZjRlMWI2YTBhNmFlMGQwYWE5NzBhYzY4MDcyNTJkMjdiIn1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0='
+ '[' false '=' true ]
+ + base64 --decode
echo 'eyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6IjlkNTBhMjAyZWVkZjljNmJkZTE5ZjNiOTVkMDg1ZjFhZjVkMDQyMTllYTAzNWNiNGY5MWJmY2Y5OTg3MTU1YmUiLCJDIjoiMDI1NzZiNzM3NmU2YjFjZDA0ZDNhODU2NjM0MGIwOTBmZjRlMWI2YTBhNmFlMGQwYWE5NzBhYzY4MDcyNTJkMjdiIn1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0='
+ DECODED_TOKEN='{"token":[{"mint":"https://mint.minibits.cash/Bitcoin","proofs":[{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}]}],"unit":"sat","memo":"Sent from Minibits"}'
+ '[' -z '{"token":[{"mint":"https://mint.minibits.cash/Bitcoin","proofs":[{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}]}],"unit":"sat","memo":"Sent from Minibits"}' ]
+ '[' false '=' true ]
+ + jq .
echo '{"token":[{"mint":"https://mint.minibits.cash/Bitcoin","proofs":[{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}]}],"unit":"sat","memo":"Sent from Minibits"}'
+ TOTAL_AMOUNT=0
+ + jq -c '.token[0].proofs[]'
echo '{"token":[{"mint":"https://mint.minibits.cash/Bitcoin","proofs":[{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}]}],"unit":"sat","memo":"Sent from Minibits"}'
+ PROOFS='{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ PROOFS_JSON='['
+ FIRST_PROOF=true
+ + jq -r .amount
echo '{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ AMOUNT=64
+ TOTAL_AMOUNT=64
+ '[' true '=' true ]
+ PROOFS_JSON='[{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ FIRST_PROOF=false
+ PROOFS_JSON='[{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}]'
+ '[' false '=' true ]
+ '[' false '=' true ]
+ + head -n 1
echo '{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ FIRST_PROOF='{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ + jq -r .secret
echo '{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ PROOF_SECRET=9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be
+ jq -r .id
+ echo '{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ PROOF_ID=00500550f0494146
+ + jq -r .C
echo '{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}'
+ PROOF_C=02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b
+ '[' -z 9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be ]
+ '[' -z 00500550f0494146 ]
+ '[' -z 02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b ]
+ get_mint_keys
+ '[' false '=' true ]
+ curl -s https://mint.minibits.cash/Bitcoin/keys -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://redeem.cashu.me/' -H 'Origin: https://redeem.cashu.me' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-GPC: 1' -H 'Priority: u=1' -H 'TE: trailers'
+ RESPONSE='{"1":"0321687c0cb918cf996dce31bc30451f8545741abb284eb5f6b882c4fc81249323","2":"0267ce6049bc2c74546d7c1b06ba403d9fbfb7e43c14b1cc03edf4f784fa0e1d81","4":"022a785df2cf2ea3fb46a116a87c05b2982da0ae885bc4d7bd7af5de628123cf96","8":"025c97833e4777a87fb7986f5433c22da2082f7105dd683f5d8fb3e440dea7299f","16":"02c7daaf5f14f9dba1ddc9f244e2e6c1e92428915034b62654c7862f75c8121dd3","32":"038c462da9dce2391ec3b4a343dba8b7b5925aafaea54ee9836b34b77ea36acaa7","64":"03875f0ce4bafc8b5df82ba47302a42f5a3293b876e368aae7c35c1a5bd57eb0e2","128":"02d4e95bcfd4241bfa19d1d952412f1b51d0375a3ed3489a519a695d0121c16413","256":"025be9deee55214111f2f79912932fc42e448a8f73ea5895f3cf1d77ea25524d2f","512":"03d49e84dd18ca4a0f3afcb0582aa712a67669f925060a040584af3ef8a74954a7","1024":"02a0efb0095ab375e72362c2fdd1b24847227b4494585735d8cf440a3a9c742b07","2048":"03fd7489ba63795bca8757cd36edb08df3d7c999e5d96827c7362fa5eed19f118f","4096":"03e01beeb2903c2848c7ea36a40fe2493a8e996e336054dc8dfd57e7934379ecc7","8192":"03ffb60322211cac6fee5f19d61fd5aaa38dabca71ee04aa3056120c02bf7a808f","16384":"025e268384922f467be366c7ced0c92f250a0b9da0e1de4b10ff708b36dea741bb","32768":"02d998b64b91d1002527b64298f460cc3626cefc827c549d930f17280db930c6ca","65536":"03dc807665127bf8472d13de4b25fe248b71b2bf6e423fc6e150574a394c927d75","131072":"024232c1028ab9ee45d394c65ccf04b158004a978858d5af29d413eb62c270ec20","262144":"023ca28651f8f2ad7789b3875bd0af9c462a1c794231f9beaaeecf0389f22d4c08","524288":"020aebbbd33b4af6e9b1f4f29d216564a794f23c7741ccd97f27f328ff8fc2a843","1048576":"029eeb9a6b4a92a9f2dfd64dc4c9c8464a977a7e3658ef55172cc296683550c365","2097152":"0320212e5bedc5ccc88f090f3f95e253b52a53391e1307ecc6fced18f732eb4fb8","4194304":"02faa595d2e95cce5cc74395f1b2df4ebbfdff34542cf91804cc480574e278f4b4","8388608":"02b0d3128e347276de25582364709c4cfd15082ac7b8474e9f27242199294e3855","16777216":"030f6dbc1c9aa0989d70acc727d75b3bc3cb5feb97a1b94f853b239865c3f06623","33554432":"03a3a52ebed62890e4508586a906c233d3bd369e159e63279af8af895a46040e7b","67108864":"0380c7273a263515f16a2424c3f89900f871b01a436213444ea7c631daa6144254","134217728":"03faf2f16d7f7dbffdb03fd336478b9d8f08217fe08411df8fd342018bac10ae0e","268435456":"024fd2feca5dafd9c1c33bcfa90fe3fc592c0c66f6bc4f8040cdabf8bb028177c6","536870912":"0255aa3c9db98b7de8e3a2b271ddf7ae70a955296fe40c7aeaa7a87b71cb58f08d","1073741824":"023343a0defc28ce08e0c658f660172da793abb8575fa5d526d5e06aaf8caa871c","2147483648":"03f1663c4b0c88fe39026845a134e4c7f54060ecf4f57bf813a38307b8202ddf75","4294967296":"02750ed0f993a99cd1b23521c68784e5481daaaa79659214f9da6468a10421b348","8589934592":"02a2ae324ac2858ebc820bc0744f5361597de7392b770955c2e838ef8e30a4e27c","17179869184":"0269ac028b1dff95ae60472cc536f98c391def179cd92b969673cc53a6610194f2","34359738368":"036b13f1f4e507bc02d02f79b275ee99570d7767dff8bc23c99c4d2b7d27542835","68719476736":"03f078c300c542e1a5a77fea1bff22a15501fe0c6b6d74de50933a3b227acfb1af","137438953472":"029b8f2969ad777f9f2a8f2af396f2c25ecd60ed2b91997407a7237ebdf0e001e5","274877906944":"038fef892409d4c71180b9361c3265545b94b4cb4a20f6c79a89147c2d2fde7540","549755813888":"029147f7335fec14cba047ef1ad0fd5fe86c1e038f37ba10d08e1e58ae56d32f64","1099511627776":"039326719785bace4b51743d8cf144000767a05763d89477a426b1217973637971","2199023255552":"03ce9d0ddad19d0e26c7577af61095365ced4c987371652a49abf9a24bc5df6539","4398046511104":"027b412e06bc9b1a0ea5816bee1da715c6e0e04a3f6ccb07b4061bb9beb28cb384","8796093022208":"02bce8417b1da85a1ae6d363915f0ffc88dca2bcc218c0e44fdafe593b8e57e896","17592186044416":"0244675e3389d074e161336f44c307009435ec1ba13ba5b904d286f5fe45b55a09","35184372088832":"03cdd6b165f2e91228ec62c651968e244074665711fb3224c1e2d3f05b3d9fedbf","70368744177664":"022891fcdb4c19adec153c5b40dd89d52a6832bc83d82911a3e7a0ac599863870d","140737488355328":"03b004d916738c2bd0e14d6ef2d185e9ac13f9ee802d2542d6081bb51ea663d4b4","281474976710656":"025d695b8f72779283b134d2b27037ba2fcedd7b63917116f01fe2dd590de4d549","562949953421312":"031563d935e7ded7a890d1687e439cd490b7f9880cb2e5c71ec7745d56db05ab29","1125899906842624":"0233ebee5a1c8473d69ecef520ead6d4f50166c243e73a76fd8d4dc13508e40181","2251799813685248":"0295935f4067726d5b2318a8218656d8e3bda961091711cdc9a30aa32f46bea90e","4503599627370496":"03d074bfde1cca405ec22fcada91220125c1bb7ea55688cc09c9b29f4c5488c076","9007199254740992":"02749e6de14e0aea7103b61984a92d77fb27b59d9cc1339f771072dc85bd011757","18014398509481984":"03314e2727b5a89ad40ddb6bda5714ee8c35c3945b52ffb4cbd2974597975af2c0","36028797018963968":"037e8aee5e6e638049cf5771fca9e1dfc9a8dda6f80f49252173653288dbd06d52","72057594037927936":"02393335234d80993ecf2322db9dc83009e7da829ed15b87a3cf9051a98fd48684","144115188075855872":"03bb338f95bc949995f1878fd35a1ebe7281b80de3aeaf905339d35d711c3a146f","288230376151711744":"0321f44454b39dfaf18b291c8670b69c71fe8506475c3f1e1bd4ee459768e7a126","576460752303423488":"03e3f21699332ff2e5b55ad7aeebc2446e191c3b9f688443834da5fc676817bf4c","1152921504606846976":"02dd4a1d8bc4ecbd625f148b2aa0222e3fdc5f7fd2d3129811ab17021bc6568615","2305843009213693952":"02bc229c45dac098426e984fb2f5434732f9a82d9ab32841c195c5a1edb9ed8607","4611686018427387904":"033ccefdcd77462cd266297f26418a9c7dc0f7866ab61528c6e987948bd18fe035","9223372036854775808":"031ae5e403d8ba3cca84ed5bccaee7ed0cfa39a8aed4b382dd660529e4dbdc5817"}'
+ '[' false '=' true ]
+ check_token
+ '[' false '=' true ]
+ curl -s -X POST https://mint.minibits.cash/Bitcoin/check -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://redeem.cashu.me/' -H 'Content-Type: application/json' -H 'Origin: https://redeem.cashu.me' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-GPC: 1' -H 'Priority: u=4' -H 'TE: trailers' --data-raw '{"proofs":[{"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be"}]}'
+ RESPONSE='{"spendable":[true],"pending":[false]}'
+ + jq -e .echo
 '{"spendable":[true],"pending":[false]}'
+ '[' false '=' true ]
+ '[' false '=' true ]
+ '[' false '=' true ]
+ '[' false '=' true ]
+ get_lnurl_details
+ '[' false '=' true ]
+ curl -s https://minibits.cash/.well-known/lnurlp/chandran -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://redeem.cashu.me/' -H 'Origin: https://redeem.cashu.me' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-GPC: 1' -H 'Priority: u=1'
+ LNURL_DETAILS='{"callback":"https://minibits.cash/.well-known/lnurlp/chandran","minSendable":1000,"maxSendable":1000000000,"metadata":"[[\"text/plain\",\"Pay to chandran@minibits.cash with Lightning. Receiver will receive ecash into Minibits Wallet.\"],[\"text/identifier\",\"chandran@minibits.cash\"]]","commentAllowed":100,"allowsNostr":true,"nostrPubkey":"beeb48407a6f087ea8f76dc384a5d88c67ced9bd9fb0cdba90930210df3d92e7","tag":"payRequest"}'
+ + jq -e .
echo '{"callback":"https://minibits.cash/.well-known/lnurlp/chandran","minSendable":1000,"maxSendable":1000000000,"metadata":"[[\"text/plain\",\"Pay to chandran@minibits.cash with Lightning. Receiver will receive ecash into Minibits Wallet.\"],[\"text/identifier\",\"chandran@minibits.cash\"]]","commentAllowed":100,"allowsNostr":true,"nostrPubkey":"beeb48407a6f087ea8f76dc384a5d88c67ced9bd9fb0cdba90930210df3d92e7","tag":"payRequest"}'
+ + jq -r .maxSendable
echo '{"callback":"https://minibits.cash/.well-known/lnurlp/chandran","minSendable":1000,"maxSendable":1000000000,"metadata":"[[\"text/plain\",\"Pay' to chandran@minibits.cash with Lightning. Receiver will receive ecash into Minibits 'Wallet.\"],[\"text/identifier\",\"chandran@minibits.cash\"]]","commentAllowed":100,"allowsNostr":true,"nostrPubkey":"beeb48407a6f087ea8f76dc384a5d88c67ced9bd9fb0cdba90930210df3d92e7","tag":"payRequest"}'
+ LNURL_AMOUNT=1000000000
+ '[' false '=' true ]
+ '[' false '=' true ]
+ get_payment_request
+ '[' false '=' true ]
+ curl -s 'https://minibits.cash/.well-known/lnurlp/chandran?amount=64000' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://redeem.cashu.me/' -H 'Origin: https://redeem.cashu.me' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-GPC: 1' -H 'Priority: u=4' -H 'TE: trailers'
+ PAYMENT_REQUEST='{"pr":"lnbc640n1pndr33epp5r9ysznwczqmqwdhqgn0lndq5s7hdqcwjgam4pd7lk80p55svd2xsdq2f38xy6t5wvcqzzsxqrpcgsp5jauqkwnqegaqdclz53e76za68yv58cfql7launffwflyrdmtfyrs9qxpqysgqjw05fst59xwyt5tt827c7j8axxecjnd984hgtr3s702gh9t8xsn8dkxnhk6nrmttg3wh57qzjmng88djjc5l96r6nge3u2uwhmfgmwsq40afyh","routes":[],"successAction":{"tag":"message","message":"Payment sent to chandran@minibits.cash."}}'
+ + jq -r .pr
echo '{"pr":"lnbc640n1pndr33epp5r9ysznwczqmqwdhqgn0lndq5s7hdqcwjgam4pd7lk80p55svd2xsdq2f38xy6t5wvcqzzsxqrpcgsp5jauqkwnqegaqdclz53e76za68yv58cfql7launffwflyrdmtfyrs9qxpqysgqjw05fst59xwyt5tt827c7j8axxecjnd984hgtr3s702gh9t8xsn8dkxnhk6nrmttg3wh57qzjmng88djjc5l96r6nge3u2uwhmfgmwsq40afyh","routes":[],"successAction":{"tag":"message","message":"Payment' sent to 'chandran@minibits.cash."}}'
+ PAYMENT_REQUEST=lnbc640n1pndr33epp5r9ysznwczqmqwdhqgn0lndq5s7hdqcwjgam4pd7lk80p55svd2xsdq2f38xy6t5wvcqzzsxqrpcgsp5jauqkwnqegaqdclz53e76za68yv58cfql7launffwflyrdmtfyrs9qxpqysgqjw05fst59xwyt5tt827c7j8axxecjnd984hgtr3s702gh9t8xsn8dkxnhk6nrmttg3wh57qzjmng88djjc5l96r6nge3u2uwhmfgmwsq40afyh
+ '[' false '=' true ]
+ check_fees
+ '[' false '=' true ]
+ curl -s -X POST https://mint.minibits.cash/Bitcoin/checkfees -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://redeem.cashu.me/' -H 'Content-Type: application/json' -H 'Origin: https://redeem.cashu.me' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-GPC: 1' -H 'Priority: u=4' -H 'TE: trailers' --data-raw '{"pr":"lnbc640n1pndr33epp5r9ysznwczqmqwdhqgn0lndq5s7hdqcwjgam4pd7lk80p55svd2xsdq2f38xy6t5wvcqzzsxqrpcgsp5jauqkwnqegaqdclz53e76za68yv58cfql7launffwflyrdmtfyrs9qxpqysgqjw05fst59xwyt5tt827c7j8axxecjnd984hgtr3s702gh9t8xsn8dkxnhk6nrmttg3wh57qzjmng88djjc5l96r6nge3u2uwhmfgmwsq40afyh"}'
+ RESPONSE='{"fee":0}'
+ '[' false '=' true ]
+ redeem_token
+ '[' false '=' true ]
+ curl -s -X POST https://mint.minibits.cash/Bitcoin/melt -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://redeem.cashu.me/' -H 'Content-Type: application/json' -H 'Origin: https://redeem.cashu.me' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-GPC: 1' -H 'Priority: u=4' -H 'TE: trailers' --data-raw '{"pr":"lnbc640n1pndr33epp5r9ysznwczqmqwdhqgn0lndq5s7hdqcwjgam4pd7lk80p55svd2xsdq2f38xy6t5wvcqzzsxqrpcgsp5jauqkwnqegaqdclz53e76za68yv58cfql7launffwflyrdmtfyrs9qxpqysgqjw05fst59xwyt5tt827c7j8axxecjnd984hgtr3s702gh9t8xsn8dkxnhk6nrmttg3wh57qzjmng88djjc5l96r6nge3u2uwhmfgmwsq40afyh","proofs":[{"id":"00500550f0494146","amount":64,"secret":"9d50a202eedf9c6bde19f3b95d085f1af5d04219ea035cb4f91bfcf9987155be","C":"02576b7376e6b1cd04d3a8566340b090ff4e1b6a0a6ae0d0aa970ac6807252d27b"}],"outputs":[], "paid_amount": 64}'
+ RESPONSE='{"paid":true,"preimage":"","change":[]}'
+ + jq --argjson total_amount 64 '. + {total_amount: $total_amount}'
echo '{"paid":true,"preimage":"","change":[]}'
+ MODIFIED_RESPONSE='{
  "paid": true,
  "preimage": "",
  "change": [],
  "total_amount": 64
}'
+ echo 'Redeem token response: {
  "paid": true,
  "preimage": "",
  "change": [],
  "total_amount": 64
}'
+ echo '{' '"paid":' true, '"preimage":' '"",' '"change":' '[],' '"total_amount":' 64 '}'
{ "paid": true, "preimage": "", "change": [], "total_amount": 64 }
Connection rejected: Token redemption failed
chGoodchild commented 2 months ago

Based on the log and script you've provided, it seems the token redemption process is executing correctly up until the final step. The error "Connection rejected: Token redemption failed" is likely occurring after the script has finished running, possibly in the system that's calling this script.

Here are a few potential reasons for this error:

  1. Token already spent: The token might have already been redeemed. The check_token function shows the token is valid, but it might have been spent in the time between checking and redeeming.

  2. Network issues: There could be intermittent network problems causing the connection to be rejected.

  3. Server-side issues: The mint server might be experiencing problems or rejecting the redemption for reasons not evident in the client-side script.

  4. Mismatched amounts: The amount in the token might not match the amount in the payment request.

  5. Timing issues: There might be a delay between generating the payment request and redeeming the token, causing the request to expire.

To troubleshoot this:

  1. Add more verbose logging, especially around the redeem_token function. Log the full request being sent and the full response received.

  2. Check if the token is still valid immediately before redemption.

  3. Verify that the amounts match exactly between the token and the payment request.

  4. Add a small delay between getting the payment request and redeeming the token to ensure all systems are in sync.

  5. Check the server logs if you have access to them.

  6. Try redeeming a smaller amount to see if it's an issue with the specific token or a general problem.

  7. Verify that the mint's API hasn't changed and that all endpoints are still correct.

  8. Check if there are any rate limiting or security measures on the server side that might be rejecting the request.

Without more information about the system calling this script and the server-side implementation, it's difficult to pinpoint the exact cause. However, these suggestions should help narrow down the problem.

chGoodchild commented 2 months ago
{ "paid": true, "preimage": "", "change": [], "total_amount": 64 }
Amount paid: 
Total amount msat: 0
Connection approved: Token redeemed successfully, sessiontime 0
METHOD: client_auth, MAC: 28:d2:44:64:f1:f7, USERNAME: 0, PASSWORD: 0
METHOD: client_auth, MAC: 28:d2:44:64:f1:f7, INGOING_BYTES: 0, OUTGOING_BYTES: 0

Fixed, the endpoint had changed the format of its response from .paid == true to "paid": true

chGoodchild commented 2 months ago
root@OpenWrt:/tmp# cat arguments_log.md 
METHOD: auth_client, MAC: 28:d2:44:64:f1:f7, USERNAME: cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6ImVjZjkzODJmMDliZWU4MmJkMTVkMGUwYzRiZjhkZjMxY2YyNjQ4MmRjMjhiYmJlNTg2NDc2NDExYjgxZWI0NTEiLCJDIjoiMDIxZDBhODBiM2EyMjc0ZDI0ZGU3OTIxYjM5MjBmMDIxYTVhZmFkNGM1ZDFjYzc0NGFkNjcyYjZkNzVkOTFkZjk3In1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0, PASSWORD: 
Auth Client - ECASH: cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6ImVjZjkzODJmMDliZWU4MmJkMTVkMGUwYzRiZjhkZjMxY2YyNjQ4MmRjMjhiYmJlNTg2NDc2NDExYjgxZWI0NTEiLCJDIjoiMDIxZDBhODBiM2EyMjc0ZDI0ZGU3OTIxYjM5MjBmMDIxYTVhZmFkNGM1ZDFjYzc0NGFkNjcyYjZkNzVkOTFkZjk3In1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0
Curl request - ECASH: 
Redeem token response: {
  "paid": true,
  "preimage": "",
  "change": [],
  "total_amount": 64
}
Curl request - ECASH: cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6NjQsInNlY3JldCI6ImVjZjkzODJmMDliZWU4MmJkMTVkMGUwYzRiZjhkZjMxY2YyNjQ4MmRjMjhiYmJlNTg2NDc2NDExYjgxZWI0NTEiLCJDIjoiMDIxZDBhODBiM2EyMjc0ZDI0ZGU3OTIxYjM5MjBmMDIxYTVhZmFkNGM1ZDFjYzc0NGFkNjcyYjZkNzVkOTFkZjk3In1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiU2VudCBmcm9tIE1pbmliaXRzIn0, Exit Code: 0
Redeem response: { "paid": true, "preimage": "", "change": [], "total_amount": 64 }
Received response: { "paid": true, "preimage": "", "change": [], "total_amount": 64 }
Amount paid: 
Total amount msat: 0
Connection approved: Token redeemed successfully, sessiontime 0
METHOD: client_auth, MAC: 28:d2:44:64:f1:f7, USERNAME: 0, PASSWORD: 0
METHOD: client_auth, MAC: 28:d2:44:64:f1:f7, INGOING_BYTES: 0, OUTGOING_BYTES: 0