2

I would like to take bitcoin block data and send it use it to avoid having to go through the blockchain download again on other computers in my local network. To ensure that no db corruption occurs, I stop bitcoin before the transfer. Running the unix command bitcoind stop will return

Bitcoin has stopped running!

I notice that it does still run in top for a few moments after getting this message. This is not a problem right as it's never more than 15 seconds, however I am looking to automate this process using a simple php script.

Using bitcoin-rpc command such as $status = $bitcoin->stop() would yeild a result of "Bitcoin has stopped running" but it may still be running in top.

How do I make sure that bitcoin really stopped running? Or is it safe to preform data transfer as soon as I get this message (does bitcoin keep writing to db after it notifies you it has stopped)?

  • 1
    You can always check the process ID if its terminated or not. Or just wait 15 seconds. The fact that it still runs in top for a couple of seconds is probably due to finalising the database, release all memory and stuff. I think you better put a sleep(15) (or 30, for safety's sake) then to program around it and make every millisecond count. – Mathias711 Apr 30 '14 at 15:29
  • Is there any way to effectively check? I know I can wait and it will likely work, but what if bitcoind gets stuck doing something? (It could be getting stuck due to another program) – Mark Apr 30 '14 at 19:39
  • 1
    I am mobile right now, so I can't search or try things and I am most certainly not into php, but I think there must be a way. Otherwise ask on the stack overflow site, because this is programming related, not Bitcoin. – Mathias711 Apr 30 '14 at 20:15
  • I was hoping somebody had bitcoin related experience with this, though you're right it's probably a question which is more programming oriented and the valid answer for another program would work for bitcoind. Thanks for your help! – Mark Apr 30 '14 at 21:00
1

On linux:

ps aux | grep bitcoind

Or even:

watch ps aux | grep bitcoind

But to answer your question slightly differently I'd suggest keeping existing bitcoind running. Then your new node add a connect statement with the local ip of the old node in the bitcoin.conf file (located usually in $HOME/.bitcoin/).

Your new node will then solely connect to the existing node and download, via your local network all the blocks from the existing node.

Also if both PCs are imobile you could leave it that way to avoid duplicate downloads from the internet. An alternative if the second is a laptop for example is to use -addnode instead. From here:

-addnode=          Add a node to connect to and attempt to keep the connection open
-connect=          Connect only to the specified node(s)
-dns                   Allow DNS lookups for -addnode, -seednode and -connect (default: 1)

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

    Not the answer you're looking for? Browse other questions tagged or ask your own question.