7
This is not a duplicate of What is the most efficient way to store bitcoin addresses in a database? but it's the same question except I need a segwit answer.
Let's say I wanted to store every standard BTC address in an SQL database. The most space efficient way is to extract the HASH160 address by converting to base58 then slicing away the checksum. This will allow you to store a BTC address in 20 bytes.
Until segwit blocks come.
Is there a way to get to the hash160 address from: bc1q34aq5drpuwy3wgl9lhup9892qp6svr8ldzyy7c
If not, could someone tell me the most space efficient way to store this address in a database?
I have no need to convert it back to original string, but only ensure its identity.
Thank you
2A popular block explorer converting addresses into hash160's in their database resulted in funds loss, since their service erroneously reported the same funds being paid to both p2pkh and p2sh addresses. Make very sure what you do is fit for purpose... – G. Maxwell – 2019-09-25T18:43:06.683
Thank you, it's just for a home machine learning project. Not a mission critical security application. – Roderick Obrist – 2019-10-16T05:19:38.583