Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin.macaroon is not created when running lnd #1190

Closed
ripper234 opened this issue May 6, 2018 · 17 comments
Closed

admin.macaroon is not created when running lnd #1190

ripper234 opened this issue May 6, 2018 · 17 comments

Comments

@ripper234
Copy link
Contributor

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 either lncli create or lncli unlock. No admin.macaroon file can be found anywhere on disk at this point.

These commands (lncli) however seem to require the existence of an admin.macaroon file.

>lncli --rpcserver=localhost:10001 --macaroonpath=C:\work\lnd\alice\data\admin.macroon getinfo
[lncli] open C:\work\lnd\alice\data\admin.macroon: The system cannot find the file specified.

Tried to touch it and then I got

[lncli] empty macaroon data

So, how do I create an initial macaroon file?

Your environment

  • lnd version 0.4.1-beta commit=097fd50747356a39593e5ac7625bf0b0fb1305a1
  • Windows 10
  • btcd compiled from source today from roasbeef branch commit a03db407e40d3b66ea29984263bbc8bf4d2f04c4
@ripper234 ripper234 changed the title Tutorial: Document how to create the initial admin.macaroon [Tutorial] Document how to create the initial admin.macaroon May 6, 2018
@dabura667
Copy link

if lnd is running with -no-macaroons, you don’t need to specify the macaroon

@ripper234
Copy link
Contributor Author

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.

@dabura667
Copy link

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

@ripper234
Copy link
Contributor Author

Is that the macaroons.db file? Because the tutorial speaks of admin.macaroon, but the file I see on disk is macaroons.db.

@ripper234
Copy link
Contributor Author

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).

@ripper234
Copy link
Contributor Author

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.

@ripper234 ripper234 changed the title [Tutorial] Document how to create the initial admin.macaroon admin.macaroon is not created when running lnd May 6, 2018
@guggero
Copy link
Collaborator

guggero commented May 6, 2018

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.

@ripper234
Copy link
Contributor Author

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.

@autemox
Copy link

autemox commented Sep 27, 2018

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.

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.

@ereztdev
Copy link

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.

@cfromknecht
Copy link
Contributor

@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

@ereztdev
Copy link

ereztdev commented Oct 17, 2018

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.

@cfromknecht
Copy link
Contributor

@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

@BrianSipple
Copy link
Contributor

BrianSipple commented Dec 7, 2018

I think the confusion here stems from two things:

  1. The tutorial snippet for lncli create uses --macaroonpath, even though it’s not needed.
  2. The path is incorrect — assuming we want it to match the file that’s automatically generated after initially running lncli create.

2. causes errors when trying to proceed from the tutorial after 1.

I submitted a PR for the fix.

@guilhermehas
Copy link

guilhermehas commented Dec 9, 2018

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

@A-qiu161203
Copy link

sir, I met the same problem as you. Have you solved this problem yet? Could you please help me? Thank you very much!

@frazras
Copy link

frazras commented Jan 4, 2022

Found mine at ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants