Author

Topic: bitcoind - what is it doing? (Read 233 times)

legendary
Activity: 3346
Merit: 3125
April 04, 2021, 11:13:39 AM
#15
Hey guys, after reading your replies i just edited my post because you are right, killall can bring problems to the bitcoin core. It can corrupt the database and that will be a big problem.

It wasn't my intention to miss information the users, as you say, the right way to do this is with the stop command on bitcoin-cli.

Code:
./bitcoin-cli stop
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
April 01, 2021, 09:37:27 PM
#14
to run commands like:  getrawtransaction and decoderawtransaction, does the blockchain have to fully downloaded?
I am at about 74.6% this evening.
getrawtransaction will require -txindex if you're querying a transaction that doesn't belong to your wallet.
And it wont work with transactions that aren't in your blockchain yet so it will return with error for some transactions if your node isn't fully synced.
Additionally, you can just add a verbose '1' or 'true' after the TXID and the result will be automatically decoded.

deconderawtransaction only decodes a raw transaction so it'll work whether its fully synced, has full transaction index or not.
HCP
legendary
Activity: 2086
Merit: 4361
April 01, 2021, 07:27:02 PM
#13
Great information and very educational - thank you very much - I executed every example statement and learned a lot.

to run commands like:  getrawtransaction and decoderawtransaction, does the blockchain have to fully downloaded?
I am at about 74.6% this evening.
Should still work "OK" if you're not fully synced... not ALL commands will thoigh.


Quote
I get this error:
Code:
./bitcoin-cli decoderawtransaction 00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09
error code: -22
error message:
TX decode failed

decoderawtransaction needs the actual raw transaction data... not the transaction ID... try this:
Code:
decoderawtransaction 02000000000101458ace070b657aacb654c3fb21f8172b3248af1d8411da314a7ed6ef986033990700000000fdffffff075532010000000000160014f229feea0a005ecc0bef615443f4f307a11f66ee583b03000000000017a914095223404b3af6500ce9091bcab36cda998cba4787392c07000000000017a9140f862146e7a500576dc2ceac6b32c238eed97b3c8784940900000000001976a914f0cff358543aab5322b7a50a1031be7a0f653a5988ac70cf10000000000017a9148048a84908896eb958b6df937b8cdc5ce94de69a87820f53000000000017a914881b738741dabd18b7f0be0e6ccc78245d60fd82876260792d000000001600143e38cb6d861323ce5f30a8e004a27cfa5abf2e4902483045022100caef78dbd023b7ef6cc6621ac9ed3565feed96c78533d4f5bcb482ea4432d08202204faefb6414ffbe226f2c1d0b675846ff9ce66f5ebd396ecd4e8a42f1052a4257012103b1a0490fe980457f2b6ac431d91287c187f5c19d9010ab78aec779ab6aa30f70f7550a00

To get the raw transaction data... you would use:
Code:
getrawtransaction TRANSACTION_ID

ie.
Code:
getrawtransaction 27151ebf894c2f1cdb6ba26ec2a5407a2378c4fb305c39b30d6406af4e986c10

That will return the raw hex... and you can then use that with decoderawtransaction


Note... if your node is not indexing transactions (ie. it does NOT have txindex=1 set in the bitcoin.conf configuration file)... then it will only be indexing transactions that relate specifically to your wallet. You won't be able to use getrawtransaction on "random" transaction IDs.


Quote
I also get an error with this command:
Code:
 ./bitcoin-cli getblockchainstatus
error code: -32601
error message:
Method not found

My bad... it's supposed to be getblockchaininfo

If you use:
Code:
./bitcoin-cli help

You'll get a list of all available commands Wink
newbie
Activity: 11
Merit: 18
April 01, 2021, 07:08:09 PM
#12
Great information and very educational - thank you very much - I executed every example statement and learned a lot.

to run commands like:  getrawtransaction and decoderawtransaction, does the blockchain have to fully downloaded?
I am at about 74.6% this evening.

I get this error:
Code:
./bitcoin-cli decoderawtransaction 00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09
error code: -22
error message:
TX decode failed

I also get an error with this command:
Code:
  ./bitcoin-cli getblockchainstatus
error code: -32601
error message:
Method not found

I am running these commands in the subdirectory /bitcoin/src where the file bitcoin-cli resides

Thanks for any suggestions or help.
HCP
legendary
Activity: 2086
Merit: 4361
March 31, 2021, 09:22:46 PM
#11
bitcoind is a "daemon" process (hence the "d" in the name)... essentially it is a background task that automatically downloads/syncs the blockchain onto your local machine. To interact with bitcoind, you use the bitcoin-cli app and pass it commands... like:
Code:
./bitcoin-cli getnetworkinfo
Code:
./bitcoin-cli getblockchainstatus
etc etc

The command for shutting down bitcoind gracefully is:
Code:
./bitcoin-cli stop


Note that if your bitcoind is configured to use a custom directory, you may need to use:
Code:
./bitcoin-cli -datadir=path/to/your/bitcoin/data/dir COMMAND_GOES_HERE
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
March 31, 2021, 05:37:01 PM
#10
bitcoind command runs bitcoin core in the back end, once it's running you can open a new terminal run bitcoin commands like 'getinfo'.

To stop the process you can use the killall command:

Code:
killall -9 bitcoind

That should do the magic.
Bitcoin Core is the GUI and it doesn't run alongside bitcoind. You either run bitcoind or Bitcoin Core.

Don't use killall. Killing the process forcefully can result in database corruption.
legendary
Activity: 3346
Merit: 3125
March 31, 2021, 04:21:00 PM
#9
Sorry for the dumb questions but as a python and JavaScript programming I am learning from well acclaimed book: "Mastering Bitcoin".   I have downloaded the bitcoin core and ran the file: "bitcoind"  per the instructions in the book.  Now I have an app bitcoind, running nonstop.  Can anyone tell me what it is doing?

How do I stop it?

bitcoind command runs bitcoin core in the back end, once it's running you can open a new terminal run bitcoin commands like 'getinfo'.

To stop the process you can use the killall command:

Code:
killall -9 bitcoind

That should do the magic.

EDIT:

Use killall is good to kill any process on Linux, but it could corrupt the bitcoin blockchain, so, is a terrible idea to use it.

The right way is using:

Code:
./bitcoin-cli stop
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
March 30, 2021, 02:59:17 AM
#8
What command do I run to see your code message below?
when i run  
Code:
./bitcoind -help
  there is no option for "progress"

That is because the progress value is on the output line itself. For example:

2021-03-30T00:26:15Z UpdateTip: new best=000000000000000000208c6dd2cf6fb587b3b317b7f9adb49bc823f86e7c3b51 height=579028 version=0x20400000 log2_work=90.701341 tx=420386654 date='2019-06-03T04:50:51Z' progress=0.669470 cache=450.3MiB(3271652txo)

So when it finishes syncing, this value will be progress=1.0.

Alternatively you can see in the text next to it that it is verifying the block mined on June 3, 2019 4:50:51 AM UTC time.

That output is usually displayed after the user runs bitcoind, or at least that's the case for me on Linux distros.

It also prints these status messages on Windows and MacOS.

i searched the Internet to find that the latest block mined at 8:30PM EST was Block 676921.

The height on my local bitcoin database is 579028 so I assume I am still catching up?

Yes. You can tell from the progress value on that line that the initial block download is 66.9470% finished.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
March 29, 2021, 10:13:19 PM
#7
The height on my local bitcoin database is 579028 so I assume I am still catching up?
Yes, there should be multiple similar lines with increasing "height".

How do I stop it?
Run in the terminal: ./bitcoin-cli stop
You don't want to force-close bitcoind since it seems to be running in the background without a terminal window, the files in the data directory might get corrupted on improper shutdown.
newbie
Activity: 11
Merit: 18
March 29, 2021, 07:31:09 PM
#6
I found debug.log.  thank you very much.  It is updating every second.  One of the latest entries:

Code:
2021-03-30T00:26:15Z UpdateTip: new best=000000000000000000208c6dd2cf6fb587b3b317b7f9adb49bc823f86e7c3b51 height=579028 version=0x20400000 log2_work=90.701341 tx=420386654 date='2019-06-03T04:50:51Z' progress=0.669470 cache=450.3MiB(3271652txo)

i searched the Internet to find that the latest block mined at 8:30PM EST was Block 676921.

The height on my local bitcoin database is 579028 so I assume I am still catching up?



legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
March 29, 2021, 05:23:00 PM
#5
What command do I run to see your code message below?
when i run   
Code:
./bitcoind -help
   there is no option for "progress"
That output is usually displayed after the user runs bitcoind, or at least that's the case for me on Linux distros. It basically outputs the logs that you would see on debug.log onto command line and is usually just it accepting new blocks or peers activity. You can see it by opening the debug.log as a text file that is located in the same directory as the blocks. Default directory for Mac is ~/Library/Application Support/Bitcoin/.
5. If i press CNTRL-C in my bitcoin/src directory where the bitcoind file is I get no response except a new terminal prompt
If you want to get the status, try ./bitcoin-cli getblockchaininfo for the synchronization progress.
newbie
Activity: 11
Merit: 18
March 29, 2021, 05:04:11 PM
#4
Thank you for your suggestions.
1. I have 4 TB of data space on an external Mac drive.

2. The bitcoin core is already downloaded to it.

3. at a terminal prompt if it type: 
Code:
./bitcoind
     the response is: "Bitcoin Core is probably already running".  The Mac app Activity Monitor shows bitcoind running and i notice that the received packets is constantly increasing. 

4. NotATether:  What command do I run to see your code message below?
when i run   
Code:
./bitcoind -help
   there is no option for "progress"

5. If i press CNTRL-C in my bitcoin/src directory where the bitcoind file is I get no response except a new terminal prompt

Thank you,
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
March 29, 2021, 02:48:38 PM
#3
If you asking about messages like these:

Code:
2021-03-29T09:52:07Z UpdateTip: new best=000000000000002a9f26661d48b554ff757ada7671ed809139d171bdd967e494 height=1968045 version=0x37ffe000 log2_work=74.051998 tx=59759391 date='2021-03-28T06:46:48Z' progress=0.999799 cache=58.2MiB(442727txo)

That means another node sent it a new block, so it's updating its blockchain "tip" (head). To see if your node has finished downloading the previous historic blocks, look at the progress= value. When it's at 1.0 it means that it has downloaded the entire blockchain up to the time and date that message was posted (which is just now).
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
March 29, 2021, 01:09:39 PM
#2
What it's doing ... it's getting in sync with the blockchain. This means it's downloading the blockchain. I hope that you do have ~350GB of free space on the disk.

When I start Bitcoind without parameters it also opens for me a console showing the current operations. If I press CTRL-C it ends gracefully.
newbie
Activity: 11
Merit: 18
March 29, 2021, 11:52:48 AM
#1
Sorry for the dumb questions but as a python and JavaScript programming I am learning from well acclaimed book: "Mastering Bitcoin".   I have downloaded the bitcoin core and ran the file: "bitcoind"  per the instructions in the book.  Now I have an app bitcoind, running nonstop.  Can anyone tell me what it is doing?

How do I stop it?


Jump to: