Skip to content

Instantly share code, notes, and snippets.

View andrewkmin's full-sized avatar
🤠

am andrewkmin

🤠
View GitHub Profile
@andrewkmin
andrewkmin / _README.md
Created June 6, 2023 17:48 — forked from r-n-o/_README.md
Bitcoin Address Derivation from Public Key

Bitcoin Address Derivation from Public Key

This gist shows how to derive a Bitcoin address using bitcoinjs-lib.

Context

Turnkey doesn't support Bitcoin address derivation yet, but it does give raw public keys. This means Bitcoin addresses can be derived on the client side. This code sample is provided as courtesy and should not be considered authoritative or production ready.

Any address derivation logic is critical because sending cryptocurrency to an address derived incorrectly can lead to permanent loss of funds. At minimum, any address derivation logic should be tested to make sure funds land on the derived deposit address correctly and that funds can be transferred back out without issues.