<p>You have the <code>data</code> and <code>network</code> arguments swapped when you create the <code>hdPrivateKey</code>, see <a href="https://bitcore.io/api/lib/private-key#new_PrivateKey_new" rel="nofollow noreferrer">Private Key | Bitcore</a>. Try this:</p>

<pre><code>var bitcore = require('bitcore-lib');
var DerivationPath = "m/44'/145'/0'/0"
var hdPrivateKey = new bitcore.HDPrivateKey('xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi', 'testnet');
var orderPrivateKey  = hdPrivateKey.derive(DerivationPath).privateKey;
var Address = orderPrivateKey.toAddress().toString();
console.log('Address: ' + Address);
</code></pre>

CC BY-SA 4.0
2018-07-13T14:19:06.133Z
2018-07-13T14:19:06.133Z
JBaczuk
<p>every time i am getting diffrent orderPrivateKey and address for same derivation path. but it should be same as i am not changing derivation path.</p>

<pre><code>var bitcore = require('bitcore-lib');
var DerivationPath = "m/44'/145'/0'/0"
var hdPrivateKey = new bitcore.HDPrivateKey('testnet','xprv8ZgxMBicQKsPdsKyyKSwTJtBXWB1rbDwEAxW3xV6xwNeCHs3n9kvFsCZim8KKMgc3wVGRJR4kJ82t9mRRr8TZ3Ybpxqp8brRA7aMVDJgCt2');
var orderPrivateKey  = hdPrivateKey.derive(DerivationPath).privateKey;
var Address = orderPrivateKey.toAddress().toString();
</code></pre>

<p>can anyone explain it??</p>

<bitcoin-core>
HD wallet getting every time diffrent derivedPrivatekey from same derivation path
rahul_eth
# HD wallet getting every time diffrent derivedPrivatekey from same derivation path

(Asked by: username_0 on 2018-07-13)

every time i am getting diffrent orderPrivateKey and address for same derivation path. but it should be same as i am not changing derivation path.

```
var bitcore = require('bitcore-lib');
var DerivationPath = "m/44'/145'/0'/0"
var hdPrivateKey = new bitcore.HDPrivateKey('testnet','xprv8ZgxMBicQKsPdsKyyKSwTJtBXWB1rbDwEAxW3xV6xwNeCHs3n9kvFsCZim8KKMgc3wVGRJR4kJ82t9mRRr8TZ3Ybpxqp8brRA7aMVDJgCt2');
var orderPrivateKey  = hdPrivateKey.derive(DerivationPath).privateKey;
var Address = orderPrivateKey.toAddress().toString();

```

can anyone explain it??

**Tags:** bitcoin-core


---

## 1 answers

### Answer by username_1 on 2018-07-13. Score: 1

You have the `data` and `network` arguments swapped when you create the `hdPrivateKey`, see [Private Key | Bitcore](https://bitcore.io/api/lib/private-key#new_PrivateKey_new). Try this:

```
var bitcore = require('bitcore-lib');
var DerivationPath = "m/44'/145'/0'/0"
var hdPrivateKey = new bitcore.HDPrivateKey('xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi', 'testnet');
var orderPrivateKey  = hdPrivateKey.derive(DerivationPath).privateKey;
var Address = orderPrivateKey.toAddress().toString();
console.log('Address: ' + Address);

```


---

