Bitcoin Forum
June 18, 2024, 06:57:59 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [base58] PUBKEY_ADDRESS has to contain prefix Mo and address length 35  (Read 344 times)
hal_jordan (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
May 19, 2018, 09:42:09 PM
 #1

I read from Bitcoin wiki https://en.bitcoin.it/wiki/List_of_address_prefixes about address prefix which is in most cases just single version byte. There are even basic examples.
What I want to know is how to get address which starts with «Mo» or Ro with address length 35 bytes?
What I have to put in PUBKEY_ADDRESS from chainparams.cpp (https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp) to achieve this?
odolvlobo
Legendary
*
Online Online

Activity: 4354
Merit: 3262



View Profile
May 20, 2018, 12:01:47 AM
Last edit: May 22, 2018, 04:56:09 AM by odolvlobo
 #2

In order to get a base-58 address with 35 characters starting with "Mo", you must encode a value between 0bb52c7e52dc7d16d2a362767fe633fe3751b8d2e73c00000000 and 0bb7a8b59e7fb242c83304156096cabfce80b3ab9875ffffffff (hex). Note that these are 26 bytes long and don't fit the standard version byte + 20 bytes + 4-byte checksum format. The simplest fix would probably be to extend the version byte to two bytes with a value of 0bb6 (hex).

Likewise, "Ro" would require a value between 0df5be9adec4aced5ccdda721feed36f39e50d3383cc00000000 and 0df83ad22a67e219525d7c11009f6a30d114080c3505ffffffff (hex), or a 2-byte version with value of 0df6 or 0df7 (hex).

Note:

I computed the "Mo" range as (20x58+46) x 5833 to (20x58+46+1) x 5833 - 1
and the "Ro" range as  (24x58+46) x 5833 to (24x58+46+1) x 5833 - 1

Also note: My original numbers were wrong due to a miscalculation.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
hal_jordan (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
May 20, 2018, 09:52:48 PM
 #3

In order to get a base-58 address with 35 characters starting with "Mo", you must encode a value between 09f5d59d241b1a2e29a5bec083bc33dfea4958764a7400000000 and 09f851d46fbe4f5a1f35605f646ccaa18178534efbadffffffff (hex). Note that these are 26 bytes long and don't fit the standard version byte + 20 bytes + 4-byte checksum format. The simplest fix would probably be to extend the version byte to two bytes with a value of 09f6 or 09f7 (hex).

Likewise, "Ro" would require a value between 0df5be9adec4aced5ccdda721feed36f39e50d3383cc00000000 and 0df83ad22a67e219525d7c11009f6a30d114080c3505ffffffff (hex), or a 2-byte version with value of 0df6 or 0df7 (hex).

Note:

I computed the "Mo" range as (20x58+46) x 5833 to (20x58+46+1) x 5833 - 1
and the "Ro" range as  (24x58+46) x 5833 to (24x58+46+1) x 5833 - 1
Maybe I don't follow you but in case I do follow, is it enough to put here 9(09 hex) and 247(f6 hex)?
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(9,247);
?
Coin-1
Legendary
*
Offline Offline

Activity: 2478
Merit: 2231



View Profile
May 22, 2018, 03:44:55 AM
Last edit: May 22, 2018, 04:24:59 AM by Coin-1
Merited by achow101 (2), ABCbits (1)
 #4

What I want to know is how to get address which starts with «Mo» or Ro with address length 35 bytes?
For example, you can use this online Base58 converter:
http://lenschulwitz.com/base58

I tested these Bitcoin-addresses 35-byte length:

Code:
Mo111111111111111111111111111111111 (Base58)
0BB52C7E52DC7D16D2A362767FE633FE3751B8D2E73C00000000 (hex)

Mozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz (Base58)
0BB7A8B59E7FB242C83304156096CABFCE80B3AB9875FFFFFFFF (hex)

Ro111111111111111111111111111111111 (Base58)
0DF5BE9ADEC4ACED5CCDDA721FEED36F39E50D3383CC00000000 (hex)

Rozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz (Base58)
0DF83AD22A67E219525D7C11009F6A30D114080C3505FFFFFFFF (hex)

As you can see, the first tree octets (1.5 bytes) are always identical in each hex addresses.


Maybe I don't follow you but in case I do follow, is it enough to put here 9(09 hex) and 247(f6 hex)?
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(9,247);
?
If you want "Mo":
0B (hex) = 11 (dec)
B6 (hex) = 182 (dec)
Code:
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(11,182);

If you want "Ro":
0D (hex) = 13 (dec)
F6 (hex) = 246 (dec)
Code:
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(13,246);
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!