<p>The issue as suggest by Andrew was in the encode function.
After using <a href="https://www.npmjs.com/package/wif" rel="nofollow noreferrer">https://www.npmjs.com/package/wif</a> everything worked perfectly as intended.</p>

CC BY-SA 3.0
2018-03-16T22:48:39.450Z
and here is the list of address prefixes: https://en.bitcoin.it/wiki/List_of_address_prefixes
pebwindkraft
CC BY-SA 3.0
2018-03-16T21:01:05.030Z
2018-03-16T21:01:05.030Z
scott
<p>They say a image speaks louder then 1000 words so:</p>

<p><a href="https://i.sstatic.net/MtgRU.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MtgRU.png" alt="enter image description here"></a></p>

<p>As you can see from the image above, this should work ?
What am i missing here? </p>

<p>This is my encode function,
<a href="http://cryptocoinjs.com/modules/currency/coinstring/" rel="nofollow noreferrer">http://cryptocoinjs.com/modules/currency/coinstring/</a></p>

<p>I can confirm the private key spitted out is in correct format for if i do a dump i get:</p>

<pre><code>$ ./src/d-cli dumpprivkey WRSybD94sWugjAQ89zyvbLsnw76ovCYEGo
BxkN86fdFBN75Aat3WCDs9w6NRHCMJJvvrDgb44Vcc23f96ohFZ5
</code></pre>

CC BY-SA 3.0
2018-03-16T20:18:14.137Z
How does your `encode()` function work? You probably aren't encoding it as base58 correctly or you are encoding the wrong thing (e.g. hex string instead of the bytes themselves).
Ava Chow
CC BY-SA 3.0
2018-03-16T20:33:32.763Z
sorry i edited my question to tell about my encode function, http://cryptocoinjs.com/modules/currency/coinstring/ and i can confirm the spitted out key is in correct format, the PREFIX is 100% correct as you can see by the image and code reference, really struggling with this one :(
scott
CC BY-SA 3.0
2018-03-16T20:39:49.913Z
You can see on the referenced encode() function that im sure im doing everything correct?
scott
CC BY-SA 3.0
2018-03-16T21:00:37.900Z
the issue was in the encode() function thanks kindly
scott
<wallet><private-key><wallet-import-format>
Converting from Private Key to WIF, what am i missing?
scott
# Converting from Private Key to WIF, what am i missing?

(Asked by: username_0 on 2018-03-16)

They say a image speaks louder then 1000 words so:

[![enter image description here](https://i.sstatic.net/MtgRU.png)](https://i.sstatic.net/MtgRU.png)

As you can see from the image above, this should work ?
What am i missing here?

This is my encode function,
<http://cryptocoinjs.com/modules/currency/coinstring/>

I can confirm the private key spitted out is in correct format for if i do a dump i get:

```
$ ./src/d-cli dumpprivkey WRSybD94sWugjAQ89zyvbLsnw76ovCYEGo
BxkN86fdFBN75Aat3WCDs9w6NRHCMJJvvrDgb44Vcc23f96ohFZ5

```

**Tags:** wallet, private-key, wallet-import-format

> **Comments:**
> **username_1**: How does your `encode()` function work? You probably aren't encoding it as base58 correctly or you are encoding the wrong thing (e.g. hex string instead of the bytes themselves).  
> **username_0**: sorry i edited my question to tell about my encode function, http://cryptocoinjs.com/modules/currency/coinstring/ and i can confirm the spitted out key is in correct format, the PREFIX is 100% correct as you can see by the image and code reference, really struggling with this one :(  
> **username_0**: You can see on the referenced encode() function that im sure im doing everything correct?  
> **username_0**: the issue was in the encode() function thanks kindly  

---

## 1 answers

### Answer by username_0 on 2018-03-16. Score: 1

The issue as suggest by Andrew was in the encode function.
After using <https://www.npmjs.com/package/wif> everything worked perfectly as intended.

> **Comments:**
> **username_2**: and here is the list of address prefixes: https://en.bitcoin.it/wiki/List_of_address_prefixes  

---

