<blockquote>
<p>How many address formats are there in dash?</p>
</blockquote>
<p>Dash seems to be pretty similar to bitcoin when it comes to address and transaction formats. You have your typical P2PK, P2PKH, P2SH.</p>
<p>Here is how to generate a standard P2PKH address (and therefore also a P2PK address).</p>
<pre><code>var bip39 = require('bip39');
var hdkey = require('hdkey');
var createHash = require('create-hash');
var bs58check = require('bs58check');

//const mnemonic = bip39.generateMnemonic(); //generates string
const mnemonic = 'thunder purchase pave tower lecture upgrade supreme half kid fitness tray shove'
const seed = bip39.mnemonicToSeedSync(mnemonic); //creates seed buffer
console.log('mnemonic: ' + mnemonic);

const root = hdkey.fromMasterSeed(seed);
const masterPrivateKey = root.privateKey.toString('hex');
//console.log('extended public key root:  ' + root.publicExtendedKey)

const addrnode = root.derive(&quot;m/44'/5'/0'/0/0&quot;);
console.log('addrnodePublicKey: '+ addrnode._publicKey.toString('hex'))
console.log('addernodePrivateKey: ' + addrnode._privateKey.toString('hex'))

const step1 = addrnode._publicKey;
const step2 = createHash('sha256').update(step1).digest();
const step3 = createHash('rmd160').update(step2).digest();

var step4 = Buffer.allocUnsafe(21);
step4.writeUInt8(0x4c, 0); 
step3.copy(step4, 1); //step4 now holds the extended RIPMD-160 result
const step9 = bs58check.encode(step4);
console.log('\n\n\nmnemonic: ',mnemonic,  '\npath: ', path, '\naddernodePrivateKey: ' , addrnode._privateKey.toString('hex'), '\naddrnodePublicKey: ', addrnode._publicKey.toString('hex'), '\nBase58Check: ' + step9);
</code></pre>
<p>Notice the only difference between this and deriving a bitcoin address is the version bytes is not 0x00 but instead 0x4c &amp; the derivation path coin index of 5 instead of 0.</p>

CC BY-SA 4.0
2018-09-17T17:19:58.770Z
2021-07-07T16:22:43.177Z
2021-07-07T16:22:43.177Z
arshbot
<p>Let's assume the private key is one of the worst low entropy private keys for demonstrative purposes is <strong>0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff</strong>.</p>

<p><strong>1. Dash P2PKH Address Calculation:</strong></p>

<p><code>% echo 0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff | bx ec-to-public | bx ec-to-address -v 76</code></p>

<p><em>XyHHinPZB5Q4FC9jtbksaQBJmXq48gtVGb</em></p>

<p><strong>2. Dash Single Signature P2SH Address Calculation</strong>:</p>

<p><code>% echo 0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff | bx ec-to-public</code> 
020d47568a5e517067a2836c3823fbc58169a7662bfae934a4d41da3e23c98d816</p>

<p><code>% echo "[020d47568a5e517067a2836c3823fbc58169a7662bfae934a4d41da3e23c98d816] checksig" | bx script-to-address -v 16</code></p>

<p><em>7fePc8Mf7RYghdxkSp5yaWfT9WR4F2Dsqa</em></p>

<p>Wonder where the 76 and 16 version numbers came from?<br>
See the Dash row within  <a href="https://github.com/libbitcoin/libbitcoin-system/wiki/Altcoin-Version-Mappings#bip44-altcoin-version-mapping-table" rel="nofollow noreferrer">https://github.com/libbitcoin/libbitcoin-system/wiki/Altcoin-Version-Mappings#bip44-altcoin-version-mapping-table</a>.</p>

CC BY-SA 4.0
2019-03-07T18:51:08.730Z
2019-03-07T18:51:08.730Z
skaht
<p>How can I generate a simple dash address from a public key?</p>

<p>How many address formats are there in dash?</p>

<address-generation><dash>
How to generate a dash address?
arshbot
# How to generate a dash address?

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

How can I generate a simple dash address from a public key?

How many address formats are there in dash?

**Tags:** address-generation, dash


---

## 2 answers

### Answer by username_0 on 2018-09-17. Score: 3 | Accepted answer

How many address formats are there in dash?

Dash seems to be pretty similar to bitcoin when it comes to address and transaction formats. You have your typical P2PK, P2PKH, P2SH.
Here is how to generate a standard P2PKH address (and therefore also a P2PK address).
var bip39 = require('bip39');
var hdkey = require('hdkey');
var createHash = require('create-hash');
var bs58check = require('bs58check');

//const mnemonic = bip39.generateMnemonic(); //generates string
const mnemonic = 'thunder purchase pave tower lecture upgrade supreme half kid fitness tray shove'
const seed = bip39.mnemonicToSeedSync(mnemonic); //creates seed buffer
console.log('mnemonic: ' + mnemonic);

const root = hdkey.fromMasterSeed(seed);
const masterPrivateKey = root.privateKey.toString('hex');
//console.log('extended public key root:  ' + root.publicExtendedKey)

const addrnode = root.derive("m/44'/5'/0'/0/0");
console.log('addrnodePublicKey: '+ addrnode._publicKey.toString('hex'))
console.log('addernodePrivateKey: ' + addrnode._privateKey.toString('hex'))

const step1 = addrnode._publicKey;
const step2 = createHash('sha256').update(step1).digest();
const step3 = createHash('rmd160').update(step2).digest();

var step4 = Buffer.allocUnsafe(21);
step4.writeUInt8(0x4c, 0); 
step3.copy(step4, 1); //step4 now holds the extended RIPMD-160 result
const step9 = bs58check.encode(step4);
console.log('\n\n\nmnemonic: ',mnemonic,  '\npath: ', path, '\naddernodePrivateKey: ' , addrnode._privateKey.toString('hex'), '\naddrnodePublicKey: ', addrnode._publicKey.toString('hex'), '\nBase58Check: ' + step9);

Notice the only difference between this and deriving a bitcoin address is the version bytes is not 0x00 but instead 0x4c & the derivation path coin index of 5 instead of 0.


---

### Answer by username_1 on 2019-03-07. Score: 1

Let's assume the private key is one of the worst low entropy private keys for demonstrative purposes is **0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff**.

**1. Dash P2PKH Address Calculation:**

`% echo 0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff | bx ec-to-public | bx ec-to-address -v 76`

*XyHHinPZB5Q4FC9jtbksaQBJmXq48gtVGb*

**2. Dash Single Signature P2SH Address Calculation**:

`% echo 0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff | bx ec-to-public`
020d47568a5e517067a2836c3823fbc58169a7662bfae934a4d41da3e23c98d816

`% echo "[020d47568a5e517067a2836c3823fbc58169a7662bfae934a4d41da3e23c98d816] checksig" | bx script-to-address -v 16`

*7fePc8Mf7RYghdxkSp5yaWfT9WR4F2Dsqa*

Wonder where the 76 and 16 version numbers came from?  
See the Dash row within <https://github.com/libbitcoin/libbitcoin-system/wiki/Altcoin-Version-Mappings#bip44-altcoin-version-mapping-table>.


---

