-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Description
Motivation
The primary motivation is to have a safer address format used for user-to-user and user-to-contract transactions/interactions.
Secondary motivations:
- try not to reinvent the wheel
- try sticking with Ethereum supported hashing methods and not introducing new ones
- make it easily implementable in contracts if needed (but it shouldn't be)
Clarification regarding in-contract implementation: assuming there is a contract call which receives an address type as a parameter, the client software should be able to convert the proposed address format to the raw Ethereum address and send that in the request.
Implementation across the ecosystem
It should be initially implemented in client side solutions and the network endpoints (RPC) would receive the current addresses. If #55 is implemented on the RPC level it would be easy to convert this format to that.
Probably it is safe to assume that data sent to the RPC/network level should be validated by the clients and no change is proposed to those levels.
Other formats
The ICAP format can safely store a reduced set of Ethereum addresses (called direct ICAP). The basic ICAP is a format allowing storage of all Ethereum addresses at the risk of checksum collision. This has been raised multiple times, see #57 and #70. The ICAP format also supports indirect ICAP addresses which work through a name registry. Maybe it is better to leave that to its own format - the ICAP.
The checksumming proposed in #55 is clever at being backward compatible. I like it personally and implemented where possible, but I do not think it is a complete solution.
Specification
1) The internally stored data should be (similar to how Bitcoin addresses are built):
[flags: 8 bit][address: 160 bit][checksum: 32 bit]
where flags
is a configuration field for future extensions and checksum
corresponds to the lowest 32 bits of the sha3/keccak hash of the address. (This is different to Bitcoin.)
2) This binary data should then be encoded using a defined alphabet, more on that later.
3) A prefix (such as E
, ET
, ETH
) would be very useful to make the address easily recognizable. This prefix could either be manually appended as a string or be part of the binary (as a special value producing those letters after the transformation).
I am leaning towards just using the prefix as a string and not being part of the binary data.
Contracts
I am not entirely sure, but it might make sense having either a flag or a different prefix to distinguish between external accounts and contract addresses.
One of the reasons is that without querying the network it would be clear that different gas costs would apply for making a value transfer. And it would be clear in which case contract interactions are possible.
Alphabets
Before deciding on an alphabet an important question to answer is whether we anticipate these addresses to be typed in or purely copy-pasted. If the ability to type in is important, probably an alphabet should be used which eliminates obvious errors (i = l = 1
, 0 = o
, u = v
).
I have experimented with different alphabets and have no conclusion yet. ethbase
are made up by me. I like ethbase-2
and ethbase-3
.
ethbase-1 abcdefghjklmnopqrstvwxyz
ethbase-2 0123456789abcdefhklmnorstuwxz
ethbase-3 123456789abcdefhklmnorstuwxz
ethbase-4 ABCDEFGHJKLMNOPQRSTVWXYZ
ethbase-5 987654321
base-36 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
base-55 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuwxyz
base-58 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
rfc4648 base32 ABCDEFGHIJKLMNOPQRSTUVWXYZ234567
z-base-32 ybndrfg8ejkmcpqxot1uwisza345h769
crockford base-32 0123456789ABCDEFGHJKMNPQRSTVWXYZ
base32hex 0123456789ABCDEFGHIJKLMNOPQRSTUV
nintendo base-32 0123456789BCDFGHJKLMNPQRSTVWXYZ
Examples
These don't have the prefix suggested above (and have flag = 1
). I can generate a larger set and publish as a gist if needed.
address ef51080ba7c0921f19fb4617c229678c88553389
ethbase-1 bhhnzhazaxzqtyqpgcddhbatkdfegfznxcyyososbex
ethbase-2 b7195o3ketcot844shuhbmt9le64f3t8oot79k3s
ethbase-3 2k635kfubsm93f7bkr46nkmem7l68slcs8l57ckse
ethbase-4 BHHNZHAZAXZQTYQPGCDDHBATKDFEGFZNXCYYOSOSBEX
ethbase-5 3326143634584248146854755777454147652553325927564561848478919
base-36 365QOV5A3FL2W2P3ERQZMIVMISU372HKN92TV9
base-55 5U46LNtk1tnMEudAacfbUAE9c6GBc2D4qw
base-58 n9zZ7sByjfR294rDVqYCy2uUv3tYa5pnQ
rfc4648 base32 HXVCCALU7AJEHYZ7NDBPQRJM6GIQVJTRFQKV2FV
z-base-32 8zinnymw9yjr8a39pdbxotjc6geoijutfoki4fi
crockford base-32 7QN220BMZ0947RSZD31FGH9CY68GN9KH5GANT5N
base32hex 7NL220BKV0947OPVD31FGH9CU68GL9JH5GALQ5L
nintendo base-32 TVQ3YCLSRJHWGYF3GVGRX5RVMJFQFD5H97002T6
address f843c676c0f3d5e1ac47472056ff55da9e2e42c9
ethbase-1 bhxcvrmhfnbcgvkayjhpqmvmnxxkbhozmkphoqvyybk
ethbase-2 bcx3ubwz1m2b5c6k409hm3fclno2u1r5c5b76bm2
ethbase-3 2kzcww8rmueftlwc6u4urn3u7ddma9mbhnzd8krr6
ethbase-4 BHXCVRMHFNBCGVKAYJHPQMVMNXXKBHOZMKPHOQVYYBK
ethbase-5 3217136285259645423933751837977796654267814649388588342414353
base-36 387ZIM0R4FK6UKHTA3AL8Q24LQCVOCWY4CTWGX
base-55 5YVYc2Hhm73jgRuMbu3KNpDUbaQdsrRcby
base-58 nyJknndQU58JASatAcvYNJfribXu1TBAY
rfc4648 base32 H4EHRTWYDZ5LYNMI5DSAVX7KXNJ4LSCZF5TPBNB
z-base-32 8hr8tusad37mapce7d1yiz9kzpjhm1n3f7uxbpb
crockford base-32 7W47HKPR3SXBRDC8X3J0NQZAQD9WBJ2S5XKF1D1
base32hex 7S47HJMO3PTBODC8T3I0LNVAND9SBI2P5TJF1D1
nintendo base-32 VB63KWM6FYQLN299G31CHS1W61M6BZYBQCWNJRC
Alternative solution
A possible alternative solution is sticking with the hex alphabet (base-16) and checksumming the content using the method described in #55.
Important differences:
- include any flag or data suggested above
- strip the hex prefix so the mixed-caps won't be modified by software believing it is a hex string, which is case agnostic