Conversions
How to convert between different aspects of data for
Token Denominations
In Cosmos, every denomination amount is formatted as an unsigned integer. With this, the chain does not have to deal with fractions. For an EVM chain this amount is typically 10**18 power, while Juno and other native Cosmos chains use the 10**6 power. This means if I want to send you 1 JUNO, I am actually sending 1,000,000 of the smaller token.
You can figure out which power a token uses by its prefix character in the denomination. In the case of JUNO, the actual denomination is shown as ujuno. This u signals that it is using any amount times 10**6 to get the human readable amount.
Address Conversions
Valoper -> Base
Convert the validator operator wallet to a standard base address
// npm i @cosmjs/encoding
import {toBech32, fromBech32} from '@cosmjs/encoding'
let toPrefix = "juno"
let initial = "junovaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcqcnylw"
let converted = toBech32(toPrefix, fromBech32(initial).data)
console.log(converted)
// juno196ax4vc0lwpxndu9dyhvca7jhxp70rmcl99tyhJuno -> Other Chain
Web UI
Typescript
Python
CLI
Hex -> Valcons
With this, you can now make a mapping between a junovaloper and signing junovalcons address
Hex -> Bech32
Convert juno address between hex and bech32 format.
Example usage:
Returns:
Raw Bytes -> Hex
Convert raw bytes output (eg. [10 21 13 127]) to hex.
Example command:
Returns:
Public Key -> Valcons
Convert a validators public key to the validator consensus tendermint address
PubKey -> Hex, Base64, or Bech32
Decode a ED25519 pubkey from hex, base64, or bech32.
Example usage:
Returns:
Last updated