Errmm this is odd. I’ve tried gaining directly using btcpay but changing the USD field to BTC but still get error message - is coingeko called in anyway (even when currency is BTC and so no conversion required)?
I think the problem now is that you set up a way to high amount. This fails for me as well. Try setting the value to 0.0001
I’ve just tried this lower BTC amount (0.1BTC) but get the same failure result:
I’ve kept trying with USD and whilst most times it fails with USD, it did get another couple of successful invoices around 12:08 (the first by using btcpay directly and then shortly afterwards via executing my code again) - so success for me is intermittent (but many more failures than success).
I think there is a maximum USD invoice amount of $395 for the BtcPay. I’ve been testing various amounts in BTC and USD and those at $395 are going through, but $396+ fails for me (at least over the last few minutes). All these recent tests have been direct via btcpay:
Do you get errors when raising an invoice for $396+ ?
Ah snap! I admit I never tried beyond $10 and I didn’t even noticed until I saw you were making invoices for 666 BTC. To be honest I don’t know what is the limit on Btcpay. I’ll have to investigate. I’m guessing its related to channel funding since it wouldn’t make sense to create invoices larger than it’s possible to receive.
Thank you so much for figuring out this limit! Yes I’m getting the same error after setting the invoice above $396.
Yes thanks, we got there in the end! My problem is that I have expensive tastes as I was always trying an amount of $400+ !
Even 0.05 BTC fails for me, so I’d imagine that the limit applies across all currencies. And like you, I was wondering if this was due to the channel funding (and hence the limit is actually a bitcoin limit in flip’s channel rather than any limit within btcpay server?) I’d be interested to know - if you happen to find out!
Anyway many thanks as that was really slowing me progressing with the course - fingers crossed it should go smoother now!
I have it! The largest open channel has a balance of 4294967295msat (or 0.04294967 BTC). Filip has set this up so long ago he didn’t remember. So I had to check in the console.
To test this out I created an invoice for 0.04294967 BTC and it worked.
I then tried creating another invoice for 0.04294968 BTC which then failed as expected!

Great job figuring this out! This will help us a lot when helping out students in the future.
Thanks again and I wish you great luck in your future studies!
A question about the invoice field.
This moment you have to fill in an amount in the invoice between 0 and 1. When you fill in 0.0001 you get a warning. How can we change this that a user can fill in 0,00001. I want this because I want test this with smaller transactions. Actually I want the currency be Satoshis. I can change the icurrency in invoice,js to BTC or SAT but makes no sence.
Found it, the line of input field in index.jad must be extended like:
input(type=‘number’,name=‘amount’, min=“0.0001”, max=“1”, step= “any”)
Glad you figured it out I’m guessing the issue you were having was due to the way JS treats numbers. Treating them as a string will help out. I have created an invoice in the GUI with 1 SAT (or 0.00000001 BTC) without issues.
Can someone please confirm that npm install and generating the private keys both work with the current versions and on windows? Im pretty much stuck, I get errors when running npm install.
I have read from @filip that we should update the version of btcpay in the package.json file, i did so (0.2.4) and as well in the package-lock.json files (also in the url given there)
Still npm install will give me errors because it cant find some files
> npm install
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\xxx\LAPP\lightning-app-boilerplate\node_modules\array-flatten
npm ERR! dest C:\xxx\LAPP\lightning-app-boilerplate\node_modules\.array-flatten.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\xxx\LAPP\lightning-app-boilerplate\node_modules\array-flatten' -> 'C:\xxx\LAPP\lightning-app-boilerplate\node_modules\.array-flatten.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\larse\AppData\Roaming\npm-cache\_logs\2020-07-04T16_17_56_184Z-debug.log
When trying to generate the private keys I then get the following error;
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'btcpay'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at [eval]:1:1
at Script.runInThisContext (vm.js:119:20)
at Object.runInThisContext (vm.js:326:38)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at evalScript (internal/bootstrap/node.js:589:27)
Thats why I assume something to go wrong in npm install with btcpay
Any help would be appreciated…
Cheers
Hello sir, it might a problem with some files on the npm installation, so try the following:
1. Remove package-lock.json, node_modules and npm cache
del package-lock.json rd /s /q node_modules npm cache clear --force
2. Retry npm install
Check if node and npm is installed correctly
for checking type
npm -v
if no number came then, npm is not installed, install it properly.
If any number came then the npm is installed properly.delete package-lock.json and run npm again
Hope you find this useful.
If you have any more questions, please let us know so we can help you!
Carlos Z.
Hi Carlos!
Thanks for the quick reply!
this command doesnt work for me, it says that /q isnt a valid parameter
rd /s /q node_modules
my npm version seems to be up to date, it is 6.14.5 (using npm -v), so npm seems to be all good.
I tried npm install again but it still gives me errors:
PS C:\XXX\LAPP\lightning-app-boilerplate>npm install
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please update to at least constantinople 3.1.1
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\XXX\LAPP\lightning-app-boilerplate\node_modules\amdefine
npm ERR! dest C:\XXX\LAPP\lightning-app-boilerplate\node_modules\.amdefine.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\XXX\LAPP\lightning-app-boilerplate\node_modules\amdefine' -> 'C:\XXX\LAPP\lightning-app-boilerplate\node_modules\.amdefine.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\larse\AppData\Roaming\npm-cache\_logs\2020-07-04T17_22_57_463Z-debug.log
there are some warnings regarding Jade as well, but I assume the issue is mainly with btcpay.
Also I have now removed package-lock.json as you said, do i need to get it again from filips git?
Best - Lars
Hello sir, ok there should be an issue or with the folder that you are trying to use the app, or you files are corrupt.
I download the lightning-app-boilerplate from filip repository.
Run “npm install” everything looks good.
Then generate my private key with:
node -p “require(‘btcpay’).crypto.generate_keypair().getPrivate().toString(16)”
So i could suggest to download the lightning-app-boilerplate in the desktop folder, try to re-run the commands from there.
Hope you find this useful.
If you have any more questions, please let us know so we can help you!
Carlos Z.
Wow it literally was a problem with the path…
Made the exact same stuff on desktop and worked like a charm, thanks!
As per lesson “Registering account” I registered on https://lightning.filipmartinsson.com/ I set my store, and as said in the settings I added the mentioned code on the store settings. and as mentioned on 3’44’’ I clicked on “test connection”. Instead of receiving a positive message I received this one “The lightning node is not synched (1586 blocks left)” As I understand this depends not of me but of the node. Is it a bug to be fixed?
Hi @cincinnato Sorry about that the lightning node has issues with pruned bitcoin node and sometimes stops syncing. I have fixed the error. Can you please try again and let me know if it works.
Now working. Thank you very much! (Received message: Connection to the lightning node succeeded. Your node address: 035be… )
Hello fellow workers. I have a difficult to generate the private key of the Lightning Network application (under Windows environment). I am referring to the lecture “Creating API keys” and to the operation described from minute 2’00’’ to 2’35’’. After downloading and installing the GitHub software I run the prompt of the commands and attempt to generate a private key. Then I receive a result as per attached image, where all the results can be read but not the private key itself! Can anybody help me?
Yes, the library was updated and the repo still contains the old instructions. Try using:
node -p "require('btcpay').crypto.generate_keypair().getPrivate('hex')"