<p>I want to generate an old Byron address.  However, depending on which software I use (<code>cardano-address</code> or <code>cardano-serialization-lib</code>), I get a different result for the same mnemonic phrase.  Here is my code for <code>cardano-serialization-lib</code>, run online with <a href="https://npm.runkit.com/" rel="nofollow noreferrer">https://npm.runkit.com/</a>:</p>
<pre><code>var bip39 = require('bip39');
var CardanoWasm = require('@emurgo/cardano-serialization-lib-nodejs');
var b58 = require('base58-js');

var digits = '0123456789abcdef'.split('')
var encodeLookup = []
var decodeLookup = {}

for (var i = 0; i &lt; 256; i++) {
  var ones = i &amp; 0xf
  var sixteens = i &gt;&gt; 4 &amp; 0xf
  var string = digits[sixteens] + digits[ones]
  encodeLookup[i] = string
  decodeLookup[string] = i
  //console.log(decodeLookup)
}

encode = function (array) {
  var length = array.length
  var string = ''
  var i = 0
  while (i &lt; length) {
    string += encodeLookup[array[i++]]
  }
  return string
}

function harden(num){
  return 0x80000000 + num;
}

const entropy = bip39.mnemonicToEntropy(
  [ &quot;test&quot;, &quot;walk&quot;, &quot;nut&quot;, &quot;penalty&quot;, &quot;hip&quot;, &quot;pave&quot;, &quot;soap&quot;, &quot;entry&quot;, &quot;language&quot;, &quot;right&quot;, &quot;filter&quot;, &quot;choice&quot; ].join(' ')
);

const rootKey = CardanoWasm.Bip32PrivateKey.from_bip39_entropy(
  Buffer.from(entropy, 'hex'),
  Buffer.from(''),
);

const accountKey = rootKey
  .derive(harden(44)) // purpose
  .derive(harden(1815)) // coin type
  .derive(harden(0)); // account #0

const utxoPubKey = accountKey
  .derive(0) // external
  .derive(0)
  .to_public();

const byronAddr = CardanoWasm.ByronAddress.icarus_from_key(
  utxoPubKey, // Ae2* style icarus address
  CardanoWasm.NetworkInfo.mainnet().protocol_magic()
);

const address = byronAddr.to_address();

console.log(b58.binary_to_base58(address.to_bytes()));
</code></pre>
<p>I get <strong>Ae2tdPwUPEZ7sZ29n6td4jkbnK31Q2BdQQ2rrMGYAXeEjVznrixjc5PZ2rj</strong> as the address.</p>
<p>Here is my command-line for <code>cardano-address</code> (yes, I'm on Windows):</p>
<pre><code>ECHO test walk nut penalty hip pave soap entry language right filter choice | &quot;%CD%\cardano-address.exe&quot; key from-recovery-phrase Byron | &quot;%CD%\cardano-address.exe&quot; key child 44H/1815H/0H/0/0 | &quot;%CD%\cardano-address.exe&quot; key public --with-chain-code | &quot;%CD%\cardano-address.exe&quot; address bootstrap --network-tag mainnet &amp; ECHO.
</code></pre>
<p>Here I get <strong>Ae2tdPwUPEZ9xFkLoCFGvtgrHc5K5jr3n1wMuVLRXSZZ32iGGyfQpZQcK6f</strong>.</p>
<p>Which one is correct?</p>

CC BY-SA 4.0
2023-02-19T10:12:30.140Z
`cardano-addresses` is official IOHK software, but the `cardano-serialization-lib` is listed on cardano.org's developers site, so it must be approved somehow, yet they don't agree on address generation.  This seems like a huge problem.  If I can't get an answer here, does anyone know a better place to raise this issue?
Addr
CC BY-SA 4.0
2023-02-23T15:08:17.913Z
you can try to ask on https://forum.cardano.org
eddex
CC BY-SA 4.0
2023-04-06T01:16:17.103Z
You should get an answer in here as the majority of the Cardano devs and main contributors are part of this community. If you don't get an answer here, then I guess we have a problem...
Falcon Stakepool
<cardano-serialization-lib><cardano-address>
Different addresses from same mnemonic?
# Different addresses from same mnemonic?

(Asked by: username_0 on 2023-02-17)

I want to generate an old Byron address.  However, depending on which software I use (cardano-address or cardano-serialization-lib), I get a different result for the same mnemonic phrase.  Here is my code for cardano-serialization-lib, run online with https://npm.runkit.com/:
var bip39 = require('bip39');
var CardanoWasm = require('@emurgo/cardano-serialization-lib-nodejs');
var b58 = require('base58-js');

var digits = '0123456789abcdef'.split('')
var encodeLookup = []
var decodeLookup = {}

for (var i = 0; i < 256; i++) {
  var ones = i & 0xf
  var sixteens = i >> 4 & 0xf
  var string = digits[sixteens] + digits[ones]
  encodeLookup[i] = string
  decodeLookup[string] = i
  //console.log(decodeLookup)
}

encode = function (array) {
  var length = array.length
  var string = ''
  var i = 0
  while (i < length) {
    string += encodeLookup[array[i++]]
  }
  return string
}

function harden(num){
  return 0x80000000 + num;
}

const entropy = bip39.mnemonicToEntropy(
  [ "test", "walk", "nut", "penalty", "hip", "pave", "soap", "entry", "language", "right", "filter", "choice" ].join(' ')
);

const rootKey = CardanoWasm.Bip32PrivateKey.from_bip39_entropy(
  Buffer.from(entropy, 'hex'),
  Buffer.from(''),
);

const accountKey = rootKey
  .derive(harden(44)) // purpose
  .derive(harden(1815)) // coin type
  .derive(harden(0)); // account #0

const utxoPubKey = accountKey
  .derive(0) // external
  .derive(0)
  .to_public();

const byronAddr = CardanoWasm.ByronAddress.icarus_from_key(
  utxoPubKey, // Ae2* style icarus address
  CardanoWasm.NetworkInfo.mainnet().protocol_magic()
);

const address = byronAddr.to_address();

console.log(b58.binary_to_base58(address.to_bytes()));

I get Ae2tdPwUPEZ7sZ29n6td4jkbnK31Q2BdQQ2rrMGYAXeEjVznrixjc5PZ2rj as the address.
Here is my command-line for cardano-address (yes, I'm on Windows):
ECHO test walk nut penalty hip pave soap entry language right filter choice | "%CD%\cardano-address.exe" key from-recovery-phrase Byron | "%CD%\cardano-address.exe" key child 44H/1815H/0H/0/0 | "%CD%\cardano-address.exe" key public --with-chain-code | "%CD%\cardano-address.exe" address bootstrap --network-tag mainnet & ECHO.

Here I get Ae2tdPwUPEZ9xFkLoCFGvtgrHc5K5jr3n1wMuVLRXSZZ32iGGyfQpZQcK6f.
Which one is correct?

**Tags:** cardano-serialization-lib, cardano-address
> **Comments:**
> **username_0**: `cardano-addresses` is official IOHK software, but the `cardano-serialization-lib` is listed on cardano.org's developers site, so it must be approved somehow, yet they don't agree on address generation.  This seems like a huge problem.  If I can't get an answer here, does anyone know a better place to raise this issue?  
> **username_1**: you can try to ask on https://forum.cardano.org  
> **username_2**: You should get an answer in here as the majority of the Cardano devs and main contributors are part of this community. If you don't get an answer here, then I guess we have a problem...  

---

## 0 answers

