Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review and update docs around pubKeyPrefix #853

Open
SimiHunjan opened this issue Dec 10, 2024 · 1 comment
Open

Review and update docs around pubKeyPrefix #853

SimiHunjan opened this issue Dec 10, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@SimiHunjan
Copy link
Collaborator

Problem

in our HAPI calls (and now in HIP-755 contract calls) there's a protobuf structure SignatureMap that's a bunch of SignaturePairs and each SignaturePair is a pubKeyPrefix and a signature. The pubKeyPrefix is described as follows:

The client may use any number of bytes from zero to the whole length of the public key for pubKeyPrefix.

Question: What's the use case where the client must (or wants) to send the public key's prefix and not the whole public key?

Answer:

You pay more for longer transactions, so it saves transaction fee costs if you use shorter prefixes.
If you’re signing a transaction for an account with only one key, then you can have an empty prefix. It’s obvious to the nodes which public key to use when checking your signature. Because there’s only one public key.
If the account has two keys, and they have the same first 3 bytes, then you can send just the first 4 bytes of each public key, and that will be enough for the nodes to know which public key goes with which signature.
If you’re writing wallet software and you aren’t sure that you’ll know which keys are on the account (or even how many there are), then you have to send the whole public key. Which will cost a little more, since your signed transaction now has more bytes.

Solution

Review and update the keys and signatures page to include the above explanation

Alternatives

No response

@SimiHunjan SimiHunjan added the enhancement New feature or request label Dec 10, 2024
@jsync-swirlds
Copy link
Member

This is also in the new(er) generated protobuf document for SignaturePair.
This copy is temporary until the current PR is merged; after that we'll need to work out a mechanism to (potentially) auto-generate these markdown files in CI (it's just a relatively simple series of protoc commands, so should not be hard).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants