Bitcoin Forum
March 28, 2024, 12:52:45 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: SegWit, NOMP (Conclusion)  (Read 211 times)
PCW (OP)
Newbie
*
Offline Offline

Activity: 23
Merit: 6


View Profile
November 26, 2019, 01:33:47 PM
Merited by hugeblack (1)
 #1

Every story needs a happy ending and although I didn’t find a Mainnet block (yet), it appears that I have the mechanisms to do so.  This is the "last chapter" but I still have a concern and a question below.

As I said in a previous post, if you make a change to mining or pool software, USE TESTNET!!!

Background:  The NOMP that I had been using for years wasn’t SegWit compliant so I couldn’t use it for Bitcoin.  I therefore needed and found a SegWit commit to a different NOMP fork, and added the code to my NOMP.  This was the solution that I chose, I could have started using different pool software or connect to a public pool.

For reference:
P2PKH script address equivalent (legacy starting with 1 on mainnet) starts with m or n on testnet
P2SH script address equivalent (legacy starting with 3 on mainnet) starts with 2 on testnet
P2WPKH script address equivalent (native SegWit starting with bc1 on mainnet) starts with tb1 on testnet

After adding the SegWit code, I installed a BitPay wallet to get a Testnet address.  The address began with an "m".  This address is used for the miner to connect to my NOMP pool.

My Testnet Bitcoin Core wallet - bitcoin-cli getnewaddress - gave me an address beginning with a "2" by default.  This address was used by the pool to communicate with the Bitcoin network.

When I found 6 Testnet blocks, I got errors in the PaymentProcessing module seconds after each find.  It turns out, that in checking the Bitcoin Testnet Block Explorer, the address associated with my found blocks began with an "m" but didn't belong to my wallet.  I have no idea where this address came from. How this address changed from a "2" to an "m" is my concern. It would be nice to return the faucet coins that I borrowed for testing, but I can't get access to this "m" account.  Obviously, I don't want anything of the sort to happen on Mainnet.

Next, using bitcoin-cli getnewaddress "" "legacy", I got an address beginning with an "m", confirmed that it belonged to my wallet, found 2 more blocks, and after 100 confirmations, funds were in my BitPay wallet.  So everything seems to work with like legacy addresses.

So on Mainnet, I'll use all addresses (ASIC miners and pool) starting with a "1".

I may try again with two "2" addresses on Testnet to see if that works.

Q: What would be the advantage of using "2" addresses on Testnet rather than "m" (and then all "3" addresses on Mainnet rather than "1")?




"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Carlton Banks
Legendary
*
Offline Offline

Activity: 3430
Merit: 3068



View Profile
November 26, 2019, 01:58:26 PM
Merited by ABCbits (1)
 #2

Q: What would be the advantage of using "2" addresses on Testnet rather than "m" (and then all "3" addresses on Mainnet rather than "1")?

depends on the script you're paying to

P2SH (starting '2' or '3') can be used to pay coinbase (or any ouput) to a segwit script. Or any script.

It can also be used to just pay to a public key hash. There's no real need to do this, unless you're paying some novel type of public key hash that isn't supported by your wallet software directly (a nice forward compatibility feature). You can simply use a regular P2PKH address, and get an identical outcome (although a desirable property is that for today's blockchain, you improve other people's coin's fungibility if they are using P2SH, but it somewhat deteriorates your own coin's fungibility...).

Another way to look at this would be at the network level. Which type of addresses are most common, '1' or '3'? I believe the answer, today in November 2019, is the '1' type, so there is no fungibility advantage in using P2SH. But that may change in the future, and the fee weighting of segwit encourages P2SH wrapped segwit outputs more than legacy P2PKH. Native segwit addresses have the same fee weighting discount, but are inherently smaller on chain than either P2PKH legacy type ouputs or P2SH wrapped segwit outputs.

So if you're going to keep your mined block reward a long time, using either P2SH wrapped segwit addresses or bech32 native segwit addresses is the prudent option. Looking at coinbase transactions today, many miners are indeed using bech32 native segwit addresses for their block reward (but it's impossible to tell whether P2SH addresses are wrapped segwit or not, as the script that the output is paid to is publicly  unknown until the coins are sent from that address)

Vires in numeris
DaveF
Legendary
*
Offline Offline

Activity: 3430
Merit: 6129


Crypto Swap Exchange


View Profile WWW
November 29, 2019, 05:30:29 PM
 #3

@PCW where did you find a NOMP with SegWit? I poked around a bit and did not find anything.
If I ever have some of that mythical thing called free time I would like to take a look at it.
Would be nice if I could just swap it out with the NOMP install that I have running now.

Thanks,
Dave

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
PCW (OP)
Newbie
*
Offline Offline

Activity: 23
Merit: 6


View Profile
December 01, 2019, 06:47:56 AM
 #4

@DaveF

@PCW where did you find a NOMP with SegWit? I poked around a bit and did not find anything.

I'm not surprised that you didn't find anything.   It took a bit of looking for me to find something.

I used the following and made the same changes to my NOMP that were made in the 3 commits mentioned in the first post.

https://github.com/zone117x/node-stratum-pool/pull/115

(Line numbers from these commits didn't match my line numbers so I had to search for the code in my modules.)

For my NOMP, I'm using modules from 2 NOMP forks (separately both were buggy) and a bit of coding of my own.  Although the topic in the link indicates that zone117x has SegWit, I wasn't comfortable swapping my NOMP for theirs so I made the changes to mine.
DaveF
Legendary
*
Offline Offline

Activity: 3430
Merit: 6129


Crypto Swap Exchange


View Profile WWW
December 01, 2019, 02:38:18 PM
 #5

@DaveF

@PCW where did you find a NOMP with SegWit? I poked around a bit and did not find anything.

I'm not surprised that you didn't find anything.   It took a bit of looking for me to find something.

I used the following and made the same changes to my NOMP that were made in the 3 commits mentioned in the first post.

https://github.com/zone117x/node-stratum-pool/pull/115

(Line numbers from these commits didn't match my line numbers so I had to search for the code in my modules.)

For my NOMP, I'm using modules from 2 NOMP forks (separately both were buggy) and a bit of coding of my own.  Although the topic in the link indicates that zone117x has SegWit, I wasn't comfortable swapping my NOMP for theirs so I made the changes to mine.

And here I was hoping for a quick and simple drop in.
Thanks for the info, I'll play around a bit and see if anything dies when I apply it to what I am running.

Either way VM snapshots are a good thing I can always revert if it goes poorly.

-Dave

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
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!