Bitcoin Forum
December 18, 2017, 05:40:01 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Block with 1 transaction(txid = merkleroot) ???  (Read 932 times)
bfisher1968
Jr. Member
*
Offline Offline

Activity: 41


View Profile
May 31, 2015, 04:40:19 PM
 #1

https://blockchain.info/block/000000000000000008dcd35e54862709e577d68ff608dc40f9858de7541b13cc

If the txid is the merkleroot when a block has only 1 transaction and you need the merkleroot to solve the block, how does the only transaction get created?

I've been searching all over and never found anything mentioning what I'm asking.

1513575601
Hero Member
*
Offline Offline

Posts: 1513575601

View Profile Personal Message (Offline)

Ignore
1513575601
Reply with quote  #2

1513575601
Report to moderator
1513575601
Hero Member
*
Offline Offline

Posts: 1513575601

View Profile Personal Message (Offline)

Ignore
1513575601
Reply with quote  #2

1513575601
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513575601
Hero Member
*
Offline Offline

Posts: 1513575601

View Profile Personal Message (Offline)

Ignore
1513575601
Reply with quote  #2

1513575601
Report to moderator
1513575601
Hero Member
*
Offline Offline

Posts: 1513575601

View Profile Personal Message (Offline)

Ignore
1513575601
Reply with quote  #2

1513575601
Report to moderator
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
May 31, 2015, 04:48:54 PM
 #2

If a block only has a coinbase transaction, the coinbase TXID is used as the merkle root hash.

bfisher1968
Jr. Member
*
Offline Offline

Activity: 41


View Profile
May 31, 2015, 05:01:07 PM
 #3

Sorry for another stupid question, but how is the coinbase transaction created? Do I create that first, use the TXID for the merkleroot and hash the block header hoping I solve the block?

http://bitcoin.stackexchange.com/questions/20721/what-is-the-format-of-coinbase-transaction I think I found part of the answer in this url.

If a block only has a coinbase transaction, the coinbase TXID is used as the merkle root hash.
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
May 31, 2015, 05:07:58 PM
 #4

Sorry for another stupid question, but how is the coinbase transaction created?

https://en.bitcoin.it/wiki/Transaction#Generation

Do I create that first, use the TXID for the merkleroot and hash the block header hoping I solve the block?

Miner generates coinbase transaction and if a block only has a coinbase transaction, the coinbase TXID is used as the merkle root hash.

DannyHamilton
Legendary
*
Offline Offline

Activity: 2002



View Profile
May 31, 2015, 05:18:11 PM
 #5

Sorry for another stupid question, but how is the coinbase transaction created? Do I create that first, use the TXID for the merkleroot and hash the block header hoping I solve the block?

The coinbase transaction (AKA Generation Transaction) is created similarly to how any other transaction is created.  The creator of the transaction chooses the outputs, and a single input. This input has a "coinbase" parameter instead of a scriptSig. The data in "coinbase" can be anything; it isn't used. Bitcoin puts the current compact-format target and the arbitrary-precision "extraNonce" number there, which increments every time the Nonce field in the block header overflows.

A miner (or mining pool) assembles a set of transactions in an arbitrary order and calculates the merkle root to be used in the block header when attempting to solve the block.  If the "set" of transactions contains ONLY the generation transaction, then the merkle root will be the hash of the generation transaction.

The rest of the block header fields are populated with the necessary data and then the miner can begin attempting to solve the block.  The block header is repeatedly hashed, while incrementing the nonce value after each attempt until one of the following:

  • The hash of the header is found to be lower in value than the current target.  Hooray, you've solved a block.  Quickly broadcast it to as many other miners and pools as you possibly can before someone else solves a block and yours is orphaned!
  • You receive a solved block from a peer that is using the same "prev_block" as you are using.  The blockchain has extended, you need to build a new block header. You may also need to build a new set of transactions (and therefore a new merkle root) if the previous block has effected the set of transactions that you had been using.
  • You have exhausted all nonce values and still haven't found a blockheader hash value that is lower than the current target.  You'll need to modify something else in the block header, and then start your search through all nonce values over again.  Some commonly modified values are the timestamp and the merkle root.  The merkle root can be modified by changing the input value of the generation transaction (extraNonce) or by updating the set of transactions being used

bfisher1968
Jr. Member
*
Offline Offline

Activity: 41


View Profile
June 04, 2015, 07:36:19 PM
 #6

Since my first post I have made a simple TCP client that send json-rpc requests like "getblocktemplate". The capabilities I'm including are coinbasetxn, workid and coinbase/append. The problem I'm having is that the coinbasetxn is not part of what I'm getting back. How do I get this information since it is needed in calculating the merkleroot?
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!