Closed friedger closed 1 year ago
If you already have a bitcoin blockchain data downloaded in another folder you don't need to re-download it.
To do this, edit the .env
file, and changed the variable BITCOIN_BLOCKCHAIN_FOLDER to the folder with the data.
This info has now been moved to the docs, and is explained here.
If you feel it needs further clarification, we should edit it there.
@friedger can you clarify what you mean here - what I need to configure when I run bitcoinknots
? if you mean this project: https://github.com/bitcoinknots/bitcoin i'm honestly not sure - but presumably it would run like a typical bitcoin core server, exposing p2p and rpc interfaces (that you will use for the burnchain config).
The stacks-blockchain config.toml is created from a sample file included here: https://github.com/stacks-network/stacks-blockchain-docker/blob/master/conf/mainnet/Config.toml.sample
However, that file is only used when there is not an existing Config.toml
(if it does exist, it's used instead of creating a new config). If you want to change your burnchain source, you can edit the file ./conf/mainnet/Config.toml
and restart.
Thanks @criadoperez and @wileyj for the reply. I am still confused.
bitcoinknots is like bitcoin core just with a UI.
I am confused because the documentation says that bitcoin core will built from source if I specify the BITCOIN_BLOCKCHAIN_FOLDER
also the config.toml and the .env have the same information:
config.toml
[burnchain]
chain = "bitcoin"
mode = "mainnet"
peer_host = "bitcoin.mainnet.stacks.org"
username = "stacks"
password = "foundation"
rpc_port = 8332
peer_port = 8333
.env
## Mainnet Defaults
BTC_HOST=bitcoin.mainnet.stacks.org
BTC_RPC_USER=stacks
BTC_RPC_PASS=foundation
BTC_RPC_PORT=8332
BTC_P2P_PORT=8333
Which data is used? Do I need to add that to my .env file?
Let me try to clarify your first point here:
I understand you are referring to what the docs say here:
If you run the script with a bitcoin node it will download and build it directly from source for increased security.
This is referring to when you run the script with a bitcoin node (within the script).
Adding the variable BITCOIN_BLOCKCHAIN_FOLDER
in the .env
file is for when you are running a Bitcoin Core as a separate process (and not for when you are building and running a bitcoin node within the script). Here you are just telling the Stacks node where to find the Bitcoin data.
I did test it with Bitcoin Core but not with bitcoinknots. But if you say bitcoinknots is a Bitcoin Core with a UI then it should work fine.
@friedger i think see what you're asking here. I'll have to run some tests before I can answer fully.
BTW, the file conf/mainnet/Config.toml
is replaced by the script. The documentation suggests differently.
BTW, the file
conf/mainnet/Config.toml
is replaced by the script. The documentation suggests differently.
You are correct - what the readme states is simply not true: https://github.com/stacks-network/stacks-blockchain-docker/blob/master/manage.sh#L436-L491
Updating your Config.toml with the your specific burnchain settings will be overwritten because it relies on env vars.
updating env vars in ./env
will result in your Config.toml being updated with these values (notice the modified BTC_HOST) from the default sample.env value of bitcoin.mainnet.stacks.org
.
## Mainnet Defaults
BTC_HOST=bitcoind.stacks.co
BTC_RPC_USER=stacks
BTC_RPC_PASS=foundation
BTC_RPC_PORT=8332
BTC_P2P_PORT=8333
however if you do use that bitcoin
flag, i.e. ./manage.sh -n mainnet -a start -f bitcoin
- the burnchain section will remain unchanged. this is incorrect, it should be set to use the local bitcoin service built/started by using the bitcoin flag on invocation.
Now, to your question about bitcoinknots
- updating the above env vars in ./env
should be all that's needed on your end.
Config.toml will be updated using the linked function in manage.sh
using the env vars.
I think that answers your question...but it also raises 2 separate issues that need to be fixed so we should leave this open until a fix is PR'ed (or remove the bitcoin option entirely, since it's clear that no one is using it - else i would have expected someone to raise that config issue).
@friedger https://github.com/stacks-network/stacks-blockchain-docker/pull/87
i've removed the bitcoin service option from this repo - it wasn't being used (else there would have been issues filed that it wasn't working correctly).
the .env
file also reflects this https://github.com/stacks-network/stacks-blockchain-docker/blob/master/sample.env#L57-L73
In short - to use your bitcoinknots
service, update the Burnchain Config section of the env file (you can update the file, then restart and the service will use the new burnchain config).
Thank you. my stacks node is syncing and talking to my bitcoin knot.
Feel free to close it if the docs are updated.
The README is not clear to me what I need to configure when I run bitcoinknots and my stacks-blockchain should talk to that bitcoin node. The bitcoin blockchain data is in a local folder.
I don't want to build a bitcoin node.
What do I need to configure?