2

The contract in eos only support idx64, idx128, idx256 type for the secondary index, and key only support idx64, how can I set the public_key as the index?

The public_key in is char[34], it's length is > 256

3
  • I known in ethereum, the address can be indexed, and its lengh is 40 bytes
    – Jimmy Guo
    Commented Jun 29, 2018 at 10:42
  • Why would you want to index by public key instead of by Account Name? Account Names are indexable as they are uint64's. And the correspond to specific public keys that can be readily retrieved from the blockchain itself. Commented Jun 29, 2018 at 15:35
  • the public_key is not relative to the account, we do offline multi signature, and allow anybody to send it to the chain @JohnHaager
    – Jimmy Guo
    Commented Jun 30, 2018 at 3:30

1 Answer 1

1

I met a similar question. It's not a good idea to make public_kay as an index (make some new key instead), but if you really want to - you can calculate sha256 of the public key and use first 64 (128 \ 256) bits as an index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.