Closed ripper234 closed 6 years ago
if lnd is running with -no-macaroons, you don’t need to specify the macaroon
It is no longer running with -no-macaroons, I just said that everything worked for me before without macaroons, I'm trying to get it to work with them now.
If you run lnd in macaroon mode it automatically generates the macaroon in the default location.
Move the macaroon file to your folder you are specifying
Is that the macaroons.db
file? Because the tutorial speaks of admin.macaroon
, but the file I see on disk is macaroons.db
.
When I try to use macaroons.db as admin.macaroon I get
[lncli] cannot determine data format of binary-encoded macaroon
So admin.macaroon must be something else. But I'm not seeing that on disk anywhere (looked in C:\Users\User\AppData\Local\Lnd
, and in my local folders).
It seems that just running lnd with no parameters creates the macaroons.db file, but contrary to the documentation it does not create an admin.macaroon file.
The admin.macaroon is only created after you run lncli unlock
or lncli create
. So you should run either of these commands first.
The macaroons.db is where the root key for the macaroons is stored, so it's in a different format and cannot be used for the --macaroonpath
parameter.
But doesn't lncli unlock
require --macaroonpath
? From your answer I guess not.
Ok, I will try this flow again and reopen if I run into issues.
The admin.macaroon is only created after you run
lncli unlock
orlncli create
. So you should run either of these commands first. The macaroons.db is where the root key for the macaroons is stored, so it's in a different format and cannot be used for the--macaroonpath
parameter.
When I do "lncli --rpcserver=localhost:10001 --macaroonpath=data/admin.macaroon create" no admin.macaroon file is created. Like the OP I have been able to do the tutorial with --no-macaroons on but when I try to complete the tutorial with macaroons, I have serious problem with no admin.macaroon file existing.
echoing this issue, I followed the same path of creating the macaroon, my network is testnet stipulated in lnd.conf as:
[Bitcoin]
bitcoin.testnet=1
bitcoin.active=1
bitcoin.node=btcd
created the macaroon with: lncli --rpcserver=localhost:10001 --macaroonpath=data/admin.macaroon create
for user under $GOPATH/dev/user/
After entering + confirming pwd,
refusing passphrase + enter for surpassing cipher seed passphrase
fresh cipher seed generated.
checking under $GOPATH/dev/user/data/
no macaroon created.
I have to say that on my first run going through simnet with the alice/bob/charlie demo it did not work until I passed the network
param stating simnet, now i'm trying to do the same, changed the lnd.conf
to testnet and now macaroons are not created.
@autemox @ereztdev the network parameter needs to be passed like lncli --network=testnet ...
. The macaroons are no longer stored in the top level data directory, they are stored in /data/chain/bitcoin/<network>
iirc. Passing the network flag instructs lncli to grab the proper one
@autemox you shouldn’t have to pass a macaroon to create
, that would create a cyclic dependency requiring the macaroon be generated before lnd has ever started
Ok @cfromknecht, your right, yet it would be wise to return a path created since the call is:
lncli --network=testnet --rpcserver=localhost:10001 --macaroonpath=data/admin.macaroon create
Which stipulates saving to data
folder.
@ereztdev macaroonpath
is always passed as an argument for where to read a macaroon. It is never used as the location to save one. Again, no macaroon path argument is required for create
I think the confusion here stems from two things:
lncli create
uses --macaroonpath
, even though it’s not needed.lncli create
.2.
causes errors when trying to proceed from the tutorial after 1
.
I submitted a PR for the fix.
Try to do
find . -name "admin.macaroon"
It saved the file in this location
data/chain/bitcoin/simnet/admin.macaroon
You can copy and paste to the right folder
cp data/chain/bitcoin/simnet/admin.macaroon data
sir, I met the same problem as you. Have you solved this problem yet? Could you please help me? Thank you very much!
Found mine at ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
Background
I successfully completed stage 1 of the tutorial using
--no-macaroons
. Now I'm trying to learn how to use macaroons.The tutorial does not explain how to create the
admin.macaroon
file. When I run lnd, it waits for the eitherlncli create
orlncli unlock
. Noadmin.macaroon
file can be found anywhere on disk at this point.These commands (
lncli
) however seem to require the existence of anadmin.macaroon
file.Tried to
touch
it and then I got[lncli] empty macaroon data
So, how do I create an initial macaroon file?
Your environment