Bitcoin Forum
May 11, 2024, 06:24:31 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Query bitcoind for block number when you only know the block hash?  (Read 1109 times)
TeraPool (OP)
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
July 12, 2011, 07:43:58 PM
 #1

So when running a pool, you can determine what your block_hash is from your "solution" that pushpool provides.

How then would you use that block_hash?

I don't really want to rely on scraping and parsing blockexplorer.com to get the relevant information I need. (ie by concatenating the block hash onto http://blockexplorer.com/block/BLOCK_HASH_HERE )

When you are given the solution from pushpool. You have the timestamp, nonce, merkle root, and previous block hash to work with as well as the current block hash.

Any way to get a transaction id or specific block number or anything else from that? Or how would you determine whether the solution found was a valid one (and not stale/invalid to the network?)
1715451871
Hero Member
*
Offline Offline

Posts: 1715451871

View Profile Personal Message (Offline)

Ignore
1715451871
Reply with quote  #2

1715451871
Report to moderator
1715451871
Hero Member
*
Offline Offline

Posts: 1715451871

View Profile Personal Message (Offline)

Ignore
1715451871
Reply with quote  #2

1715451871
Report to moderator
No Gods or Kings. Only Bitcoin
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715451871
Hero Member
*
Offline Offline

Posts: 1715451871

View Profile Personal Message (Offline)

Ignore
1715451871
Reply with quote  #2

1715451871
Report to moderator
1715451871
Hero Member
*
Offline Offline

Posts: 1715451871

View Profile Personal Message (Offline)

Ignore
1715451871
Reply with quote  #2

1715451871
Report to moderator
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
July 12, 2011, 08:29:02 PM
 #2

So when running a pool, you can determine what your block_hash is from your "solution" that pushpool provides.

How then would you use that block_hash?
You return it to whatever gave it to you.

Quote
I don't really want to rely on scraping and parsing blockexplorer.com to get the relevant information I need. (ie by concatenating the block hash onto http://blockexplorer.com/block/BLOCK_HASH_HERE )
That would only work if the block made it into the public hash chain. Are you talking about solved blocks that have already been committed and confirmed?

Quote
When you are given the solution from pushpool. You have the timestamp, nonce, merkle root, and previous block hash to work with as well as the current block hash.

Any way to get a transaction id or specific block number or anything else from that? Or how would you determine whether the solution found was a valid one (and not stale/invalid to the network?)
That's not the miner's problem. The miner is given enough information to solve the block or generate a work unit. The miner does not have the entire block, just the header. In general, there's no way to get the rest of the information.

What's your outer problem? Why do you think you need this information and where are you when you're trying to get it? (Are you the miner? Are you the pool manger?)

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
TeraPool (OP)
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
July 12, 2011, 10:05:04 PM
 #3

Thanks JoelKatz.

In this particular problem, I am the pool manager.

When pushpool (default setup) solves a block, it makes a note in the mysql database by placing a "Y" in both the "our_result" and "upstream_result" columns.

I can then query the database every few minutes to look for such an event, extract it's "solution" from that same table and calculate that block's hash value out of it.

What I really need to do is be able to query the ./bitcoind listtransactions command with the exact time that I can extract from the assumed valid and paid out "solution". If I can correspond the two times (from listtransactions and pushpool's block solution) then I can assume that the block is valid and after x number of confirmations... pay it out to my miners appropriately.

In writing the above paragraph I believe I just realized what must be done.

1) Dump all transaction information using the php json rpc and listtransactions command every day to a mysql table. Giving me a list of all blocks that were in the "generate" category that day.

2) Match the times in the above generated table to the times in the assumed valid pushpool solution.

3) Calculate number of shares per worker created during each gap between solved blocks and pay them out accordingly.

Wow, you're like a technical psychologist or something. Thanks again.
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!