<p>Litecoin uses exactly the same procedure to generate addresses, the only difference is the network prefix.</p>

<p>On step <strong>4 (Add version byte in front of RIPEMD-160 hash)</strong> instead of <code>0x00</code> for bitcoin use </p>

<p><code>0x30</code> for Litecoin main-net or </p>

<p><code>0x6F</code> for Litecoin test-net.</p>

<p>Your address should start with L then and will be a valid Litecoin address.</p>

<p><strong>Full sequence:</strong></p>

<p>0 - Having a private ECDSA key</p>

<pre><code>18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725
</code></pre>

<p>1 - Take the corresponding public key generated with it (65 bytes, 1 byte 0x04, 32 bytes corresponding to X coordinate, 32 bytes corresponding to Y coordinate)</p>

<pre><code>0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
</code></pre>

<p>2 - Perform SHA-256 hashing on the public key</p>

<pre><code>600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408
</code></pre>

<p>3 - Perform RIPEMD-160 hashing on the result of SHA-256</p>

<pre><code>010966776006953D5567439E5E39F86A0D273BEE
</code></pre>

<p><strong>4 - Add version byte in front of RIPEMD-160 hash (<code>0x30</code> for Litecoin Main Network)</strong></p>

<pre><code>30010966776006953D5567439E5E39F86A0D273BEE
</code></pre>

<p>(note that below steps are the Base58Check encoding, which has multiple library options available implementing it)</p>

<p>5 - Perform SHA-256 hash on the extended RIPEMD-160 result</p>

<pre><code>27872C1C5DF98F26A09EEBE7A048A52CCFFD647098EACDB6D5D48563B0DBE7B4
</code></pre>

<p>6 - Perform SHA-256 hash on the result of the previous SHA-256 hash</p>

<pre><code>713B731B0E30DDD0B6E1F73E2EA2A1E298A35BBDB37FF13C593028515C3B2B50
</code></pre>

<p>7 - Take the first 4 bytes of the second SHA-256 hash. This is the address checksum</p>

<pre><code>713B731B
</code></pre>

<p>8 - Add the 4 checksum bytes from stage 7 at the end of extended RIPEMD-160 hash from stage 4. This is the 25-byte binary Litecoin Address.</p>

<pre><code>30010966776006953D5567439E5E39F86A0D273BEE713B731B
</code></pre>

<p><strong>9 - Convert the result from a byte string into a base58 string using Base58Check encoding. This is the most commonly used Litecoin Address format</strong></p>

<p><a href="https://live.blockcypher.com/ltc/address/LKKSCYdyWP7fJDMZ1KUDbpj3yPmQ22MQrv/" rel="noreferrer">LKKSCYdyWP7fJDMZ1KUDbpj3yPmQ22MQrv</a></p>

CC BY-SA 4.0
2018-07-03T10:16:00.363Z
Was confused because [here](https://en.bitcoin.it/wiki/File:PubKeyToAddr.png) it shows that Bitcoin's testnet prefix is `0x6f` as well. Apparently Bitcoin and Litecoin share same the testnet prefix.
thalisk
CC BY-SA 3.0
2017-12-14T22:22:23.043Z
2018-02-21T06:34:09.437Z
2018-02-21T06:34:09.437Z
Stepan Snigirev
<pre><code>$ python3.6 ltc_address_generator.py 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
LKKSCYdyWP7fJDMZ1KUDbpj3yPmQ22MQrv
</code></pre>

<hr>

<p>Please try the following py script, and generate a <strong>ltc address</strong> for your public key.</p>

<pre><code>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import hashlib
import base58


def sha256(hexstr):
    """sha256 hash algorithm
    """
    return hashlib.new('sha256', bytes.fromhex(hexstr)).hexdigest()


def rip160(hexstr):
    """ripemd160 hash algorithm
    """
    return hashlib.new('ripemd160', bytes.fromhex(hexstr)).hexdigest()


def get_ltc_address(pubkey):
    """https://bitcoin.stackexchange.com/questions/65282/how-is-a-litecoin-address-generated
    """
    rip160_hash = "30" + rip160(sha256(pubkey.upper()).upper()).upper()
    sha256_hash = sha256(sha256(rip160_hash).upper()).upper()
    return base58.b58encode(bytes.fromhex(rip160_hash + sha256_hash[0:8]))


if __name__ == '__main__':
    import sys

    if len(sys.argv) != 2:
        print("[*] Usage: python %s publickey")
        sys.exit(1)

    print(get_ltc_address(sys.argv[1]))

# references
# https://en.bitcoin.it/wiki/Protocol_documentation#Addresses
# https://gist.githubusercontent.com/circulosmeos/97f2c155777434081cb56886c1b608be/raw/f960b4e89e86dcdf77fb6288c1005a7cb847cc98/easy-litecoin-address-from-public-key.py
# https://bitcoin.stackexchange.com/questions/65282/how-is-a-litecoin-address-generated
# https://bitcoin.stackexchange.com/questions/56923/is-this-how-to-generate-a-bitcoin-address-with-python
# https://iancoleman.io/bip39/
</code></pre>

CC BY-SA 4.0
2019-02-19T05:12:08.470Z
2019-02-19T05:12:08.470Z
debug
<p>How is a litecoin address generated? What hashing do they use?</p>

<p>For example, bitcoin addresses are generated like so: <a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses</a></p>

<p>I am looking for an answer like that but can't find it anywhere. Any litecoin searches turn up with bitcoin links.</p>

<p>Please do not give me Litecoin address generation sites or wallets to download. I want to know how I can manually program a litecoin address generator. </p>

<litecoin><address-generation>
How is a Litecoin address generated?
Jim B
# How is a Litecoin address generated?

(Asked by: username_0 on 2017-12-14)

How is a litecoin address generated? What hashing do they use?

For example, bitcoin addresses are generated like so: <https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses>

I am looking for an answer like that but can't find it anywhere. Any litecoin searches turn up with bitcoin links.

Please do not give me Litecoin address generation sites or wallets to download. I want to know how I can manually program a litecoin address generator.

**Tags:** litecoin, address-generation


---

## 2 answers

### Answer by username_1 on 2017-12-14. Score: 8

Litecoin uses exactly the same procedure to generate addresses, the only difference is the network prefix.

On step **4 (Add version byte in front of RIPEMD-160 hash)** instead of `0x00` for bitcoin use

`0x30` for Litecoin main-net or

`0x6F` for Litecoin test-net.

Your address should start with L then and will be a valid Litecoin address.

**Full sequence:**

0 - Having a private ECDSA key

```
18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

```

1 - Take the corresponding public key generated with it (65 bytes, 1 byte 0x04, 32 bytes corresponding to X coordinate, 32 bytes corresponding to Y coordinate)

```
0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

```

2 - Perform SHA-256 hashing on the public key

```
600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

```

3 - Perform RIPEMD-160 hashing on the result of SHA-256

```
010966776006953D5567439E5E39F86A0D273BEE

```

**4 - Add version byte in front of RIPEMD-160 hash (`0x30` for Litecoin Main Network)**

```
30010966776006953D5567439E5E39F86A0D273BEE

```

(note that below steps are the Base58Check encoding, which has multiple library options available implementing it)

5 - Perform SHA-256 hash on the extended RIPEMD-160 result

```
27872C1C5DF98F26A09EEBE7A048A52CCFFD647098EACDB6D5D48563B0DBE7B4

```

6 - Perform SHA-256 hash on the result of the previous SHA-256 hash

```
713B731B0E30DDD0B6E1F73E2EA2A1E298A35BBDB37FF13C593028515C3B2B50

```

7 - Take the first 4 bytes of the second SHA-256 hash. This is the address checksum

```
713B731B

```

8 - Add the 4 checksum bytes from stage 7 at the end of extended RIPEMD-160 hash from stage 4. This is the 25-byte binary Litecoin Address.

```
30010966776006953D5567439E5E39F86A0D273BEE713B731B

```

**9 - Convert the result from a byte string into a base58 string using Base58Check encoding. This is the most commonly used Litecoin Address format**

[LKKSCYdyWP7fJDMZ1KUDbpj3yPmQ22MQrv](https://live.blockcypher.com/ltc/address/LKKSCYdyWP7fJDMZ1KUDbpj3yPmQ22MQrv/)

> **Comments:**
> **username_2**: Was confused because [here](https://en.bitcoin.it/wiki/File:PubKeyToAddr.png) it shows that Bitcoin's testnet prefix is `0x6f` as well. Apparently Bitcoin and Litecoin share same the testnet prefix.  

---

### Answer by username_3 on 2019-02-19. Score: 0

```
$ python3.6 ltc_address_generator.py 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
LKKSCYdyWP7fJDMZ1KUDbpj3yPmQ22MQrv

```

---

Please try the following py script, and generate a **ltc address** for your public key.

```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import hashlib
import base58

def sha256(hexstr):
    """sha256 hash algorithm
    """
    return hashlib.new('sha256', bytes.fromhex(hexstr)).hexdigest()

def rip160(hexstr):
    """ripemd160 hash algorithm
    """
    return hashlib.new('ripemd160', bytes.fromhex(hexstr)).hexdigest()

def get_ltc_address(pubkey):
    """https://bitcoin.stackexchange.com/questions/65282/how-is-a-litecoin-address-generated
    """
    rip160_hash = "30" + rip160(sha256(pubkey.upper()).upper()).upper()
    sha256_hash = sha256(sha256(rip160_hash).upper()).upper()
    return base58.b58encode(bytes.fromhex(rip160_hash + sha256_hash[0:8]))

if __name__ == '__main__':
    import sys

    if len(sys.argv) != 2:
        print("[*] Usage: python %s publickey")
        sys.exit(1)

    print(get_ltc_address(sys.argv[1]))

# references
# https://en.bitcoin.it/wiki/Protocol_documentation#Addresses
# https://gist.githubusercontent.com/circulosmeos/97f2c155777434081cb56886c1b608be/raw/f960b4e89e86dcdf77fb6288c1005a7cb847cc98/easy-litecoin-address-from-public-key.py
# https://bitcoin.stackexchange.com/questions/65282/how-is-a-litecoin-address-generated
# https://bitcoin.stackexchange.com/questions/56923/is-this-how-to-generate-a-bitcoin-address-with-python
# https://iancoleman.io/bip39/

```


---

