Title: Block with 1 transaction(txid = merkleroot) ??? Post by: bfisher1968 on May 31, 2015, 04:40:19 PM https://blockchain.info/block/000000000000000008dcd35e54862709e577d68ff608dc40f9858de7541b13cc (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. Title: Re: Block with 1 transaction(txid = merkleroot) ??? Post by: Muhammed Zakir on May 31, 2015, 04:48:54 PM If a block only has a coinbase transaction, the coinbase TXID is used as the merkle root hash. Title: Re: Block with 1 transaction(txid = merkleroot) ??? Post by: bfisher1968 on May 31, 2015, 05:01:07 PM 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 (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. Title: Re: Block with 1 transaction(txid = merkleroot) ??? Post by: Muhammed Zakir on May 31, 2015, 05:07:58 PM 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. Title: Re: Block with 1 transaction(txid = merkleroot) ??? Post by: DannyHamilton on May 31, 2015, 05:18:11 PM 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:
Title: Re: Block with 1 transaction(txid = merkleroot) ??? Post by: bfisher1968 on June 04, 2015, 07:36:19 PM 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?
|