Author

Topic: Bitcoind and incoming blocks scanning (Read 501 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
March 10, 2016, 03:25:47 PM
#4
Sorry, no so clear.

Do you mean run client like this ?

 sudo bin/bitcoind -datadir=.bitcoin -port=88888 -rpcport=99999 -rpcallowip=127.0.0.1 -rpcuser=bitcoinrpc -rpcpassword=password -blocknotify

Any examples ?

Thanks

Kinda. So you would run Bitcoind like this bitcoind -datadir=.bitcoin -port=88888 -rpcport=99999 -rpcallowip=127.0.0.1 -rpcuser=bitcoinrpc -rpcpassword=password -blocknotify=
where is whatever command you want to run whenever you receive a block.

An Example:
bitcoind -datadir=.bitcoin -port=88888 -rpcport=99999 -rpcallowip=127.0.0.1 -rpcuser=bitcoinrpc -rpcpassword=password -blocknotify="bitcoin-cli getblock %s > block-%s.txt"
%s in the command is replaced by the block hash automatically by this flag so you would literally have %s in the command wherever you need to have the block hash.

I think that should work, although I am testing it right now and will get back to you when that runs.
Edit: It works.
newbie
Activity: 15
Merit: 1
March 10, 2016, 02:53:06 PM
#3
Sorry, no so clear.

Do you mean run client like this ?

 sudo bin/bitcoind -datadir=.bitcoin -port=88888 -rpcport=99999 -rpcallowip=127.0.0.1 -rpcuser=bitcoinrpc -rpcpassword=password -blocknotify

Any examples ?

Thanks
staff
Activity: 3458
Merit: 6793
Just writing some code
March 10, 2016, 02:09:37 PM
#2
You can use the -blocknotify= option to run a command every time a new block is received. The command can just be a bash script which can then get the block hash and look up the block through bitcoin-cli and get the JSON to parse it.
newbie
Activity: 15
Merit: 1
March 10, 2016, 02:01:19 PM
#1
Hello!

Want to scan incoming blocks with native bitcoind client.

Could you please clarify

1. Can I connect to the bitcoind "pipe line with incoming blocks"
2. How can I process "parse" data blocks ? any libraries, solutions ?
3. Any advice how to make it KISS ?


Thanks!
Jump to: