π₯Accounts (Low-Level)
Pre-Readings
Accountsβ
For accounts (standard senders of transactions) , we support users from four L1 blockchain ecosystems currently (Ethereum, Bitcoin, Solana, and Cosmos).
Ethereum
BitBadges allows Ethereum addresses to use Ethereum's ECDSA secp256k1 curve for keys. The public key for these accounts will be a custom type (forked from Ethermint). This satisfies the EIP84 for full BIP44 paths. The root HD path for BitBadges Ethereum-based accounts is m/44'/60'/0'/0
. BitBadges uses the Coin type 60
for Ethereum type accounts, unlike other Cosmos accounts that use Coin type 118.
Signing Method: Transactions can be signed with EIP712 or JSON. These can be generated via the BitBadges SDK. An example of EIP712 is provided below.
EIP712 is only allowed for small messages due to its poor performance on-chain. For messages taht exceed this limit, we require JSON format.
Solana
BitBadges also extends the SDK's functionality to support Solana signatures signing with a ed25519 key. Addresses are expected to be in the native Base58 format.
Signing Method: Transactions will be signed in JSON stringified format with all keys alphabetically sorted. JSON messages can be generated via the SDK.
Solana has a limit of ~1000 byte message signatures. If the JSON exceeds this limit, we allow signing the SHA256 hash of the JSON as well.
Cosmos
Normal Cosmos accounts are also supported with all the Cosmos SDK's native functionality. We refer you to their documentation for further information.
Bitcoin
BitBadges supports Bitcoin P2WPKH addresses and BIP322 signature verification.
Signing Method: Transactions will be signed in JSON stringified format with all keys alphabetically sorted. JSON messages can also be generated via the SDK.
Public Key Types
For standard Cosmos accounts and Bitcoin accounts, the public key will have the "@type": "/cosmos.crypto.secp256k1.PubKey"
.
For Solana accounts, the public key will have the "@type": "/cosmos.crypto.ed25519.PubKey"
.
For standard Ethereum accounts, the public key will have the "@type": "/ethereum.PubKey"
.
{"@type":"/ethereum.PubKey","key":"AsV5oddeB+hkByIJo/4lZiVUgXTzNfBPKC73cZ4K1YD2"}
Deriving BitBadges Ethereum Account from a private key/mnemonicβ
Below you will see an example code snippet on how to derive a BitBadges Account from a private key and/or a mnemonic phase:
Let's see an example code snipped on how to derive a public key from a private key:
Acknowledgements
Credit to https://docs.injective.network/learn/basic-concepts/accounts and https://docs.evmos.org/protocol/concepts/accounts.
Last updated