uport-project / uport-registry

Core uPort registry contract for linking attributes to uPort identities. DEPRECATED
Apache License 2.0
64 stars 27 forks source link

IPFS hash in bytes32 #43

Open Aniket-Engg opened 6 years ago

Aniket-Engg commented 6 years ago

In the readme, i found this: let value = 'myValue' // a string (bytes32), the data you want to register. // Could be an ipfs hash for example. I visited : https://ethereum.stackexchange.com/questions/24545/how-to-store-and-load-an-ipfs-hash-as-bytes32-in-contract-written-in-solidity

Is it possible to add an IPFS hash in byte32 type?

oed commented 6 years ago

You are right, it's not possible to store the entire ipfs hash in a bytes32 type. An ipfs hash is 34 bytes, you can however strip the first two bytes and store the rest of the data, then you could store the first two bytes as part of the key, or you could just assume the first two bytes since they are 1220 in most cases.

Aniket-Engg commented 6 years ago

@oed Yes, it would be great if this can be updated in README