pooler / cpuminer

CPU miner for Litecoin and Bitcoin
https://bitcointalk.org/index.php?topic=55038.0
Other
2.79k stars 1.21k forks source link

No support for Bech32 addresses #174

Closed AdeBlanche closed 5 years ago

AdeBlanche commented 6 years ago

When i set "coinbase-addr" to a bech32 address (address starting with bc1) i get the error message:

minerd: invalid address -- 'bc1qc07c4qsx9sc73pv2xld46u28l6zea6epazsn0u'

vereen-cf commented 6 years ago

You can use CryptoCurrencyTools to convert your private key into a bech32 address and a legacy address. Remember to download the GitHub repo and go offline before entering your private key!

kerberosxyz commented 5 years ago

With Litecoin, following issue occurs:

Is there any plan to add segwit support to minerd?

pooler commented 5 years ago

When starting the wallet with "-addresstype=p2sh-segwit" (which is in fact the default if you don't specify the address type), it generates "M" addresses. You can mine to this address with minerd, but when finding a block it does not give you any reward.

That's because cpuminer interprets such an address differently from a standard Litecoin client. cpuminer currently interprets all addresses as P2PKH, except for addresses with a version of 5 or 196 (Bitcoin's P2SH versions for mainnet and testnet, respectively), which are interpreted as P2SH. Litecoin also used to use version 5 (i.e. address starts with '3') for mainnet P2SH addresses, but in 2017 it switched to version 50 (i.e. address starts with 'M') to differentiate itself from Bitcoin. If you use this tool to convert your P2SH address starting with 'M' to its legacy format starting with '3', everything should work.

The reason why version 50 is not automatically recognized as P2SH is that other cryptocurrencies (e.g. Myriad) use this version number for their P2PKH addresses. The proper way to handle this conflict would probably be to add command-line flags to cpuminer so that one can explicitly state the type of the provided address.

Is there any plan to add segwit support to minerd?

I'm not making any promises, but I'll give it a shot if time allows.

pooler commented 5 years ago

Support for bech32 addresses added in 7e89602.

kerberosxyz commented 5 years ago

Support for bech32 addresses added in 7e89602.

Thanks alot for this update! I can now indeed mine to native segwit addreses.

Jolly-Pirate commented 3 years ago

Can you add support for P2SH too?