Bitcoin Forum
July 27, 2024, 12:18:54 PM *
News: Help 1Dq create 15th anniversary forum artwork.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcoind to display coinbase message/relayed by: string  (Read 57 times)
BitcoinSoloMiner (OP)
Member
**
Offline Offline

Activity: 142
Merit: 25


View Profile
July 03, 2024, 11:20:24 AM
Last edit: July 03, 2024, 03:07:45 PM by BitcoinSoloMiner
Merited by LoyceV (4), ABCbits (4)
 #1

the block explorer sites show either a known pool or 'unknown' for this variable

how can i set up an argument for bitcoind to display the string which shows the 'relayed by'/coinbase message?

OS: ubuntu 22.04 default

example:

Code:
UpdateTip: new best=xxxx... blah1 blah2 blah3... coinbase message:'mined by pool'

i know i could use 'bitcoin-cli getinfo hash' manually after i see the updatetip from bitcoind but i was wondering if its possible to have this done in bitcoind automatically?

would something like:

Code:
bitcoind -blocknotify="bitcoin-cli getblock %s 2 | less | grep coinbase | awk -F '"' '{print $4}' | xxd -r -p" 

be the answer?

this doesnt quite work and gives me a ">" (waiting for input) instead of running bitcoind

edit:

ive put the code:

Code:
bitcoin-cli getblock %s 2 | less | grep coinbase | awk -F '"' '{print $4}' | xxd -r -p

into blocknotify.txt (same directory) and using:
Code:
bitcoind -blocknotify="cat blocknotify.txt"

but im thinking that it wouldnt appear in the same terminal that bicoind is running...


final edit:

got it working:


blocknotify.sh (remember to 'chown +x blocknotify.sh'):
Code:
#!/bin/bash
bitcoin-cli getblock "$@" 2 | less | grep coinbase | awk -F '"' '{print $4}' | xxd -r -p

then run bitcoind with path to blocknotify.sh and argument %s:
Code:
bitcoind -blocknotify="/path/to/blocknotify.sh %s"

it now shows the coinbase message along with an audible beep 

LoyceV
Legendary
*
Offline Offline

Activity: 3388
Merit: 17090


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
July 03, 2024, 12:59:06 PM
Last edit: July 03, 2024, 01:10:10 PM by LoyceV
Merited by ABCbits (1)
 #2

Code:
bitcoind -blocknotify="cat blocknotify.txt"
It looks like blocknotify needs to run a script, not a text file.

but im thinking that it wouldnt appear in the same terminal that bicoind is running...
I'd say you can use blocknotify to output the data to a (text) file, and use tail -f on your terminal to view it.

Why keep bitcoind running in a terminal in the first place? I started mine on January 8, and it's output is invisible for me.

BitcoinSoloMiner (OP)
Member
**
Offline Offline

Activity: 142
Merit: 25


View Profile
July 03, 2024, 01:22:48 PM
 #3

thanks, i will try a .sh script

i like to see when new blocks are generated, now i just want to add the relayed by info aswell

i couldnt find anything using search and google also, im surprised no one has asked this question before
LoyceV
Legendary
*
Offline Offline

Activity: 3388
Merit: 17090


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
July 03, 2024, 01:39:44 PM
 #4

i like to see when new blocks are generated
See if you can find a working version of BitBonkers somewhere. It was a nice site to see new blocks years ago.

BitcoinSoloMiner (OP)
Member
**
Offline Offline

Activity: 142
Merit: 25


View Profile
July 03, 2024, 03:02:51 PM
Last edit: July 05, 2024, 11:24:06 AM by BitcoinSoloMiner
 #5

thanks loyce,
https://bitcointalk.org/index.php?topic=448565.msg4933145#msg4933145
that link helped me to figure it out

see edited OP for solution ( I was using /s instead of %s and didn't supply %s as argument when calling blocknotify.sh --oops)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!