Skip to content

Instantly share code, notes, and snippets.

@Reecepbcups
Created February 15, 2023 14:45
Show Gist options
  • Save Reecepbcups/f9f8e713cb98da51dc6cec014ea7e62b to your computer and use it in GitHub Desktop.
Save Reecepbcups/f9f8e713cb98da51dc6cec014ea7e62b to your computer and use it in GitHub Desktop.
Convert a HexAddress to the nodes signing address (valcons)
// ex: "GetBlockByHeightRequest" grpc call returns the validatorAddress as hex
// npm i '@cosmjs/encoding
import {fromHex, toBech32} from '@cosmjs/encoding'
// where junovalcons is the prefix for the chain. It MUST be valcons, you can not convert to valoper or normal address from here
const prefix = "junovalcons"
let addr = toBech32(prefix, fromHex("80F24BFDA3E6A8C1BAC0517E7665AC9145D609F7"))
// here this addr is for SG-1 on juno, which matches their signer address of junovalcons1sreyhldru65vrwkq29l8vedvj9zavz0hxyeejf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment