user98139: How do we retrieve the xpub and the private key (for signature) of a given path (m/87h/0h/0h, for example) for legacy and descriptor wallets in Bitcoin Core?

user-1: There is no xpub in legacy wallets: https://bitcoin.stackexchange.com/a/107918/, use dumpwallet for private keys.
listdescriptors can be used to get xpub and xprv for descriptor wallets

98139: <p>How do we retrieve the xpub and the private key (for signature) of a given path (m/87h/0h/0h, for example) for legacy and descriptor wallets in Bitcoin Core?</p>
 -1: <p>There is no xpub in legacy wallets: <a href="https://bitcoin.stackexchange.com/a/107918/">https://bitcoin.stackexchange.com/a/107918/</a>, use <code>dumpwallet</code> for private keys.</p>
<p><a href="https://github.com/bitcoin/bitcoin/pull/21500" rel="nofollow noreferrer"><code>listdescriptors</code></a> can be used to get xpub and xprv for descriptor wallets</p>
