Open richardpringle opened 4 years ago
I just want to mention how we are solving our problem atm if we want String input of some address: https://github.com/AdExNetwork/adex-validator-stack-rust/blob/master/primitives/src/validator.rs#L61
It's not even Checksum-ed, but rather on serialization we checksum it or interaction with ABI, etc. This way you avoid having issues if you've input an incorrect address (i.e. not checksum-ed correctly) in configuration.
PS: I've just realized this is a different repo already :sweat_smile:
@elpiel - continuing our discussion here:
I don't have an actual need for string addresses right now beyond the
serde
support for theH160
, but I would like to have the ability to input smart-contract addresses into my system by configuration, and it would be better if those addresses were checksum validated. I also print addresses from time to time and it would also be better if I printed checksum addresses.Beyond checksum addresses, I would imagine that this crate could also take a public key (as bytes) as input and output an
H160
address. I realize that hashing the public key and taking the last 20 bytes is pretty simple, but I haven't found any good libraries that abstract this away for me. Higher-level projects should not concern themselves with hashing algorithms and how an address is derived from a public key, only that it can be done.