I am trying to store a bitcoin address in my Solidity smart contract. The Bitcoin address is 34 bytes. The largest type I found in Solidity is Bytes32. Is there a way of storing this address?
A bitcoin address is produced from the output of a RIPEMD160 hash, which is only 20 bytes. The "friendly" looking bitcoin addresses you're using to seeing have been base58 encoded.
Rather than using two 256bit words for storage, I'd suggest you base58 decode your addresses, after which they'll fit in a single word, with room to spare.
Comments
See also Solidity Tutorial on types.
The "friendly" looking bitcoin addresses you're using to seeing have been base58 encoded.
Rather than using two 256bit words for storage, I'd suggest you base58 decode your addresses, after which they'll fit in a single word, with room to spare.