Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: PCW on November 19, 2019, 03:47:57 PM



Title: SegWit, NOMP, and Empty Blocks...
Post by: PCW on November 19, 2019, 03:47:57 PM
Eight months ago or so, I wanted to solo mine some "lesser known" coins and the only way to do so was to use my own pool.

I found NOMP, which mostly didn't work and had long since been abandoned. Piecing together modules from 2 different NOMP forks, along with some coding, I was able to get it to work and successfully ASIC mine dozens of Scrypt and sha256 coins. (Every single one has lost significant value but that's another discussion.)

I now want to use my NOMP pool to solo mine Bitcoin.  (I know that I have a better chance of throwing a stone and hitting the moon than finding a block, but that's also another discussion.)

SegWit doesn't appear to be implemented in NOMP.

I read that SegWit doesn't apply the the coinbase transaction so:

QUESTION: If I change my NOMP code to create Empty Blocks (with only the coinbase transaction) will I get around the problem of other (SegWit-compliant) nodes considering my block as invalid?

To be clear, I'm using Bitcoin Core 0.18 and non-SegWit compliant pool software.

(And when I read that my block will be considered invalid, I assume that means that if I happen solve a block, that all mining effort will have been wasted, no exception.)


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: jackg on November 19, 2019, 03:55:06 PM
Segwit compliant blocks still have coinbase transactions. You might have to adapt more of the protocol for the block to be mined and check what info it needs including in a block (most coins will tell you this in their code or on a wiki).


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: PCW on November 19, 2019, 04:50:40 PM
This is a true statement:

Segwit compliant blocks still have coinbase transactions.

but my understanding is that SegWit compliance doesn't apply/relate to the coinbase transaction because there are no inputs:

from a bitcoin.stackexchange.com post:

Quote
[The] coinbase transaction has no inputs and therefore cannot be a segwit transaction. However, BIP141 specifies that the Witness Commitment is optional if there is no segwit transaction included. Therefore, there is no reliable way to determine whether or not an empty block is segwit or non-segwit.

so given this, I was hoping that an Empty Block (block with only the coinbase transaction) would NOT be considered invalid to a SegWit compliant node.

Is this true?  Comments?


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: Carlton Banks on November 19, 2019, 05:57:51 PM
QUESTION: If I change my NOMP code to create Empty Blocks (with only the coinbase transaction) will I get around the problem of other (SegWit-compliant) nodes considering my block as invalid?

???

there's nothing to get around, segwit being activated won't invalidate your block. pools were mining non-segwit blocks long after activation, they probably still are

after all, segwit was a softfork, that means everything that was valid before is still valid afterwards


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: domob on November 19, 2019, 06:35:51 PM
after all, segwit was a softfork, that means everything that was valid before is still valid afterwards

This is not true, and in fact just reversed.  A soft fork means that old code will accept blocks/transactions following the new rules, i.e. valid blocks afterwards were valid before.  Or put differently, you only add new restrictions.

EDIT:  Added the part in italics to make the meaning clear.


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: Carlton Banks on November 19, 2019, 07:09:52 PM
A soft fork means that old code will accept the new rules

nope, that's wrong


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: jackg on November 19, 2019, 08:03:43 PM
A soft fork means that old code will accept the new rules

nope, that's wrong

Yeah I agree with Carlton here. The segwit soft fork meant that legacy blocks are still accepted after the fork but this doesn't work the other way... From what I can tell the signed part of segwit transactions just get ignored by full nodes before v13 and they just take the 150 byte transactions (as an example from the standard size) because the longest chain is running with them (and there isn't a reasonable rival).



@op why do you not want to mine segwit txs, anyway yes they won't be segwit compliment if the coinbase pays to legacy but you're also not doing much to help the network by confirming transactions if you just pass in your own.


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: PCW on November 19, 2019, 08:26:34 PM
@op why do you not want to mine segwit txs, anyway yes they won't be segwit compliment if the coinbase pays to legacy but you're also not doing much to help the network by confirming transactions if you just pass in your own.

(And when I read that my block will be considered invalid, I assume that means that if I happen solve a block, that all mining effort will have been wasted, no exception.)

In the last line of my original post (above) I assumed that if my non-SegWit compliant NOMP pool software found and submitted a non-compliant block, that the block would be determined to be invalid by SegWit-compliant nodes, thereby wasting all of my mining efforts.

Is that true?

I then assumed that I could either only include non-SegWit compliant transactions in the block or, since I wasn't too sure how many of those still existed, I would make Empty Blocks (blocks with only the coinbase transaction) since, as I read, the coinbase transaction doesn't use SegWit since there are no inputs...

...but if as Carlton (and I assume you) say, it doesn't matter (e.g., what I asked above is not true), then I can just keep doing what I'm doing.

Comment?


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: jackg on November 19, 2019, 08:30:15 PM
No old legacy blocks are still compatible now.

Version numbers aren't used anymore since asicboosy use them to get a faster block hash so you should be able to mine legacy or empty blocks (with just a coinbase) without them being rejected.


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: PCW on November 19, 2019, 08:33:59 PM
@jackg

I just added an additional fact above (an edit) that I should have mentioned before and want to know if it makes a difference...

To be clear, I'm using Bitcoin Core 0.18 and non-SegWit compliant pool software.

Thanks


Title: Re: SegWit, NOMP, and Empty Blocks...
Post by: Carlton Banks on November 19, 2019, 09:58:15 PM
You're doing the right thing, mining directly on the network is no joke of an undertaking, you need to be super certain that nothing is preventing you from finding valid blocks and getting a block in the chain


That's why you should test your setup on the Bitcoin testnet first. In many ways, it's become a testing ground for miners these days anyway