> For the complete documentation index, see [llms.txt](https://artsnl.gitbook.io/artsnl-knowledge-space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://artsnl.gitbook.io/artsnl-knowledge-space/bitcoin/public-address.md).

# Public Address

How to create a bitcoin public address

## P2PKH

Raw code example of creating a P2PKH (aka legacy) public address in ARTSNL:

{% hint style="info" %}
The below code utilizes the uncompressed version of a public key. A compressed version of a public key will generate a totally different public address.
{% endhint %}

```
let result = ecc.pointFromScalar(privateKey, false)
let riped = bitcoin.crypto.hash160(result)
let prefix = Buffer.from("6F", "hex")
let prefix_riped = [prefix, riped]
let combined_prefix_riped = Buffer.concat(prefix_riped)
let checksum = bitcoin.crypto.sha256(bitcoin.crypto.sha256(combined_prefix_riped)).slice(0, 4)
let arr = [prefix, riped, checksum]
let combinedBuff = Buffer.concat(arr)
let address = base58.encode(combinedBuff)
```
