格式化 pubkey
tendermint 格式
https://docs.tendermint.com/master/spec/blockchain/encoding.html
<PrefixBytes> <Length> <ByteArray>
.
Prefix || Length (of raw bytes) || raw bytes ( while || stands for byte concatenation here).
Type | Name | Prefix | Length | Notes |
---|---|---|---|---|
PubKeyEd25519 | tendermint/PubKeyEd25519 | 0x1624DE64 | 0x20 | |
PubKeySr25519 | tendermint/PubKeySr25519 | 0x0DFB1005 | 0x20 | |
PubKeySecp256k1 | tendermint/PubKeySecp256k1 | 0xEB5AE987 | 0x21 | |
PrivKeyEd25519 | tendermint/PrivKeyEd25519 | 0xA3288910 | 0x40 | |
PrivKeySr25519 | tendermint/PrivKeySr25519 | 0x2F82D78B | 0x20 | |
PrivKeySecp256k1 | tendermint/PrivKeySecp256k1 | 0xE1B0F79B | 0x20 | |
PubKeyMultisigThreshold | tendermint/PubKeyMultisigThreshold | 0x22C1F7E2 | variable |
Example
For example, the 33-byte (or 0x21-byte in hex) Secp256k1 pubkey020BD40F225A57ED383B440CF073BC5539D0341F5767D2BF2D78406D00475A2EE9
asEB5AE98721020BD40F225A57ED383B440CF073BC5539D0341F5767D2BF2D78406D00475A2EE9
java 格式化 pubkey