ARTSNL
  • 👋Introducing ARTSNL
  • Overview
    • 💡Motivation & Meaning
    • ✨Advantages
    • ⚒️Features
  • Fundamentals
    • 🛠️Getting set up
      • 🚦Where to start
      • 🛑Important
  • Key Generation
    • 👩‍🍳DIY Binary
    • 🎲Random Entropy
  • BITCOIN
    • 🟠Public Address
  • ETHEREUM
    • 🔵Public Address
  • GOING FORWARDS
    • 🛣️Roadmap
  • DESIGN
    • 🟣Name/Logo
    • 🎨UI/UX
    • 💻Code
  • DEVS
    • 🔐Security
    • 🐛Known Bugs
    • ⛓️Backend Tooling
Powered by GitBook
On this page
  1. BITCOIN

Public Address

How to create a bitcoin public address

P2PKH

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

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.

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)

PreviousRandom EntropyNextPublic Address

Last updated 1 year ago

🟠