Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: gigabytecoin on June 29, 2011, 01:37:11 AM



Title: What is the longest possible Bitcoin address? Are they all the same length?
Post by: gigabytecoin on June 29, 2011, 01:37:11 AM
I am working on creating a mysql database and don't want to waste any extra storage space.

So what should I make an entry for a bitcoin address?

CHAR X length? (is the address consistently one length?)

Or VARCHAR X length? (does the address change in length from user to user?)


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: EricJ2190 on June 29, 2011, 01:46:19 AM
From the Wiki (https://en.bitcoin.it/wiki/Address):
Quote
Addresses can contain all alphanumeric characters except 0, O, I, and l. Normal addresses currently always start with 1, though this might change in a future version. Testnet addresses usually start with m or n. Mainline addresses can be 25-34 characters in length, and testnet addresses can be 26-34 characters in length. Most addresses are 33 or 34 characters long, though.

You'll probably want to store them in a VARCHAR. Although, if you really want to save space, you can Base58 decode them and store them in binary without the checksum using only 20 bytes.


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: gigabytecoin on June 29, 2011, 01:56:57 AM
From the Wiki (https://en.bitcoin.it/wiki/Address):
Quote
Addresses can contain all alphanumeric characters except 0, O, I, and l. Normal addresses currently always start with 1, though this might change in a future version. Testnet addresses usually start with m or n. Mainline addresses can be 25-34 characters in length, and testnet addresses can be 26-34 characters in length. Most addresses are 33 or 34 characters long, though.

You'll probably want to store them in a VARCHAR. Although, if you really want to save space, you can Base58 decode them and store them in binary without the checksum using only 20 bytes.

Hehe, thank you for the suggestions.

Thankfully my OCD isn't THAT out of whack ;)

Take care,


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: estenity on August 11, 2016, 07:46:22 PM
is it possible to transform an address with 33 characters to the same with 34 characters ? if yes, what is the modification ?


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: DannyHamilton on August 11, 2016, 08:49:25 PM
is it possible to transform an address with 33 characters to the same with 34 characters?

Yes.

if yes, what is the modification ?

You can either add a space character at the beginning of the address, or (if you prefer) you can add a space character at the end of the address.

Why would you want to do this though?


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: estenity on August 11, 2016, 10:11:21 PM
because an internet site asks me to use a 34-character format.

thank you for response.


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: DannyHamilton on August 11, 2016, 10:19:37 PM
because an internet site asks me to use a 34-character format.

thank you for response.

If the website is stripping off the whitespace, and isn't aware that bitcoin addresses aren't all 34 characters, then I'd avoid that website.  They clearly don't understand what they are doing well enough to do it properly and you are likely to have lots of problems in the future with things they don't do well.


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: cr1776 on August 11, 2016, 11:04:01 PM
because an internet site asks me to use a 34-character format.

thank you for response.

If the website is stripping off the whitespace, and isn't aware that bitcoin addresses aren't all 34 characters, then I'd avoid that website.  They clearly don't understand what they are doing well enough to do it properly and you are likely to have lots of problems in the future with things they don't do well.

Danny is correct.  If they don't have something that basic down, you should avoid them.

HOWEVER, if you absolutely have to use them, you can generate some new addresses and look for one that matches the 34 characters they are looking for.


Title: Re: What is the longest possible Bitcoin address? Are they all the same length?
Post by: estenity on August 11, 2016, 11:04:30 PM
because an internet site asks me to use a 34-character format.

thank you for response.

If the website is stripping off the whitespace, and isn't aware that bitcoin addresses aren't all 34 characters, then I'd avoid that website.  They clearly don't understand what they are doing well enough to do it properly and you are likely to have lots of problems in the future with things they don't do well.

correct. thank you very much indeed.