1

Is a Segwit wallet able to generate and use non-Segwit addresses?

I'm using Bitpay's Bitcore to create wallets and generate new addresses for the users of my platform. I'm also using Bitcore-wallet-client to sign transactions.

My users have legacy wallets right now. I intend to migrate their wallets to native Segwit, but they will also need legacy addresses so that they can receive coins from anywhere. (right?)

Is it possible to have only one wallet per user, generating both types of addresses, or will I have to manage two wallets per user?

And if I have to manage two wallets per user, utxos from one wallet won't be available to the other, obviously. What's the best way to deal with their 'split balance'? Should I orient users to send all their coins to the bc1 address of the new Segwit wallet? But then, whenever they receive funds in their legacy addresses, they'd have to transfer again to the bc1 address in order to make Segwit transactions. It makes no sense - or does it? What am I missing?

1

I am not familiar with the wallets generated by BitPay's Bitcore specifically, but there is no general issue preventing a wallet from generating addresses of various output formats. If BitPay's wallets can only either do one or the other that would be a local implementation quirk.

While it is possible to maintain separate wallets for each user, it is rather costly to do your accounting on-chain.

The more common mode of operations for services that take custody of user funds is to only maintain a single deposit wallet. You would then generate a new address on this "omnibus wallet" for each user deposit. Since the addresses are unique, you can use the address to tell which customer to credit in your internal accounting.

However, on the operational side, you can batch multiple withdrawals into a single transaction and even move part of the funds to a cold wallet to improve your security.

3
  • Thanks a lot, Murch! Oct 28 '20 at 17:28
  • 1
    "If BitPay's wallets can only either do one or the other that would be a local implementation quirk." Yes, that was indeed the issue. Bitpay's Bitcore expects an address type as a parameter for creating new wallets. Then, it uses that value whenever you ask it to create a new address. So I just added another parameter for the createAddress flow, and there I pass the addressType. Now wallets created with this system can generate and use all types of addresses. Funnily enough, the system knows how to sign everything. I have no idea why they would tie one address type with the wallet. Oct 28 '20 at 21:06
  • 1
    Maybe they assumed that it's too confusing for users to have more than one type of address or something.
    – Murch
    Oct 29 '20 at 3:54
1

Can a single wallet generate (and use) both SegWit and non-SegWit addresses?

Yes. Example: In Bitcoin Core you can can run getnewaddress with address_type in the argument

getnewaddress

I intend to migrate their wallets to native Segwit, but they will also need legacy addresses so that they can receive coins from anywhere.

Most of the apps, websites, services etc. now support native segwit addresses however p2sh-segwit addresses can be used if bech32 addresses not supported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.