Author

Topic: Raw original work request of solved block (Read 241 times)

newbie
Activity: 18
Merit: 4
January 14, 2018, 11:28:34 PM
#11
This helped me when I played around with the stratum protocol a few years ago, might help you a bit (see "Building Local Work"): http://archive.is/CH9a0

Seems its not example of actually solvable block. Result hash is not less than target. Or I got the markel wrong ?

http://learnmeabitcoin.com/tools/hashblockheader/?version=2&hashPrevBlock=000000001e920b44c0c6771b61e57a48787fe66d2aae448f19e2f65af8b6164d&hashMerkleRoot=4f699989fde3ff7ad9824846f4fb4c72c35fa8a716cef88fdda926ccf7cc8a6e&time=2012-09-11+00%3A33%3A49&bits=1c2ac4af&nonce=2996141058&submit=true
newbie
Activity: 18
Merit: 4
January 13, 2018, 10:39:02 PM
#10
This helped me when I played around with the stratum protocol a few years ago, might help you a bit (see "Building Local Work"): http://archive.is/CH9a0

Thanks that's what I wanted.
member
Activity: 210
Merit: 26
High fees = low BTC price
January 13, 2018, 06:56:54 PM
#9
https://github.com/bitcoin/bitcoin/blob/master/src/consensus/merkle.cpp#L9. Basically you concatenate the txids of pairs of transactions and hash them, then concatenate pairs of

I was hoping the hash was just the previous hash added to a hash of all the data below the header for the block

Nothing is easy with bitcoin but it's good to see you know your stuff so i will bookmark the post and thanks
newbie
Activity: 35
Merit: 0
January 13, 2018, 10:57:05 AM
#8
This helped me when I played around with the stratum protocol a few years ago, might help you a bit (see "Building Local Work"): http://archive.is/CH9a0
newbie
Activity: 18
Merit: 4
January 13, 2018, 12:18:50 AM
#7
Ok so if I'm getting what you are saying is, once the block is solved below markel_root becomes a transaction id to send newly generated coins which is already included in blocexplorer's transactions

merkle_root = sha256(sha256(unhexlify(coinbase)).digest()).digest()
No, not at all.

The coinbase transaction's txid is included as part of the merkle root. The construction of the merkle root is described here: https://github.com/bitcoin/bitcoin/blob/master/src/consensus/merkle.cpp#L9. Basically you concatenate the txids of pairs of transactions and hash them, then concatenate pairs of hashes, and so on until there is only one hash remaining.

The fields Coinbase1, ExtraNonce, ExtraNonce2, and Coinbase2 are used to construct the coinbase transaction which pays the miner. The transaction id of that coinbase transaction is then used to construct the merkle root.

Correct you are referring to process of calculating markel, actually I need all those parameters to test my application is actually calculating same markel and all the required inputs further to find same nonce as blockexplorer. That's just for end to end testing of my own mining application.
staff
Activity: 3458
Merit: 6793
Just writing some code
January 13, 2018, 12:00:50 AM
#6
Ok so if I'm getting what you are saying is, once the block is solved below markel_root becomes a transaction id to send newly generated coins which is already included in blocexplorer's transactions

merkle_root = sha256(sha256(unhexlify(coinbase)).digest()).digest()
No, not at all.

The coinbase transaction's txid is included as part of the merkle root. The construction of the merkle root is described here: https://github.com/bitcoin/bitcoin/blob/master/src/consensus/merkle.cpp#L9. Basically you concatenate the txids of pairs of transactions and hash them, then concatenate pairs of hashes, and so on until there is only one hash remaining.

The fields Coinbase1, ExtraNonce, ExtraNonce2, and Coinbase2 are used to construct the coinbase transaction which pays the miner. The transaction id of that coinbase transaction is then used to construct the merkle root.
newbie
Activity: 18
Merit: 4
January 12, 2018, 11:39:05 PM
#5
Not just transaction ids, all of the parameters below
Coinbase1
ExtraNonce
ExtraNonce2
Coinbase2
Transaction Ids[]
Those parameters are part of the transaction ids. All of those parameters except for transaction Ids[] are for constructing the coinbase transaction. It's txid is then used in the merkle root.

But to form a block header, I need markel which is calculated using coinbase + transaction ids. Right ? I'm referring to the logic from the reference link and other miner source code I referred, which happen to be doing same thing.

Edit 1:
Ok so if I'm getting what you are saying is, once the block is solved below markel_root becomes a transaction id to send newly generated coins which is already included in blocexplorer's transactions

merkle_root = sha256(sha256(unhexlify(coinbase)).digest()).digest()

Edit 2:
I just tested markel calculation just using transaction id from random solved block and its not matching with that blocks markel.
Am I missing something, to reverse engineer the solved block ?


staff
Activity: 3458
Merit: 6793
Just writing some code
January 12, 2018, 07:26:50 PM
#4
Not just transaction ids, all of the parameters below
Coinbase1
ExtraNonce
ExtraNonce2
Coinbase2
Transaction Ids[]
Those parameters are part of the transaction ids. All of those parameters except for transaction Ids[] are for constructing the coinbase transaction. It's txid is then used in the merkle root.
newbie
Activity: 18
Merit: 4
January 12, 2018, 07:24:31 PM
#3
The merkle root is computed from the transaction ids.

Not just transaction ids, all of the parameters below
Coinbase1
ExtraNonce
ExtraNonce2
Coinbase2
Transaction Ids[]


ref:
https://github.com/m0mchil/poclbm/blob/2ae15b77df1d17d2ec2748673ba2e8e0a01891c5/StratumSource.py

Code:
j.extranonce2 = self.increment_nonce(j.extranonce2)
coinbase = j.coinbase1 + self.extranonce + j.extranonce2 + j.coinbase2
merkle_root = sha256(sha256(unhexlify(coinbase)).digest()).digest()

for hash_ in j.merkle_branch:
merkle_root = sha256(sha256(merkle_root + unhexlify(hash_)).digest()).digest()
merkle_root_reversed = ''
for word in chunks(merkle_root, 4):
merkle_root_reversed += word[::-1]
merkle_root = hexlify(merkle_root_reversed)
staff
Activity: 3458
Merit: 6793
Just writing some code
January 12, 2018, 07:14:38 PM
#2
The merkle root is computed from the transaction ids.
newbie
Activity: 18
Merit: 4
January 12, 2018, 02:53:13 PM
#1
Does anybody has the actual raw work request of solved block ? I'm just creating mining application and need to very it actually working after that all endiness conversion mombo jumbo. The only missing part from blockchain explorer is params used to create markel root. Appreciate if anybody has it handy or pull from their log or something.

Just to add more below params I'm after of any solved block to test

Coinbase1
ExtraNonce
ExtraNonce2
Coinbase2
Transaction Ids[]
Jump to: