Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

app, docs: update Bech32 HRP #476

Merged
merged 4 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

### State Machine Breaking

* (app) [tharsis#476](https://github.com/tharsis/ethermint/pull/476) Update Bech32 HRP to `ethm`.

## [v0.5.0] - 2021-08-20

### State Machine Breaking

* (app, rpc) [tharsis#447](https://github.com/tharsis/ethermint/pull/447) Chain ID format has been changed from `<identifier>-<epoch>` to `<identifier>_<EIP155_number>-<epoch>`
in order to clearly distinguish permanent vs impermanent components.
* (app, evm) [tharsis#434](https://github.com/tharsis/ethermint/pull/434) EVM `Keeper` struct and `NewEVM` function now have a new `trace` field to define
Expand Down
2 changes: 1 addition & 1 deletion client/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func AddrCmd() *cobra.Command {
Short: "Convert an address between hex and bech32",
Long: "Convert an address between hex encoding and bech32.",
Example: fmt.Sprintf(
`$ %s debug addr eth10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
`$ %s debug addr ethm10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
$ %s debug addr 0xA588C66983a81e800Db4dF74564F09f91c026351`, version.AppName, version.AppName),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
16 changes: 8 additions & 8 deletions cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (
)

const (
// EthBech32Prefix defines the Bech32 prefix used for EthAccounts
EthBech32Prefix = "eth"
// Bech32Prefix defines the Bech32 prefix used for EthAccounts
Bech32Prefix = "ethm"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = EthBech32Prefix
Bech32PrefixAccAddr = Bech32Prefix
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
Bech32PrefixAccPub = EthBech32Prefix + sdk.PrefixPublic
Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
Bech32PrefixValAddr = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
Bech32PrefixValPub = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
Bech32PrefixConsAddr = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

const (
Expand Down
24 changes: 12 additions & 12 deletions docs/basics/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ The root HD path for Ethermint-based accounts is `m/44'/60'/0'/0`.
[BIP-0173](https://github.com/satoshilabs/slips/blob/master/slip-0173.md) defines a new format for segregated witness output addresses that contains a human-readable part that identifies the Bech32 usage. Ethermint uses the following HRP (human readable prefix) as the base HRP:

| Network | Mainnet | Testnet | Regtest |
| --------- | ------- | ------- | ------- |
| Ethermint | `eth` | `eth` | |
|-----------|---------|---------|---------|
| Ethermint | `ethm` | `ethm` | |

There are 3 main types of HRP for the `Addresses`/`PubKeys` available by default on Ethermint:

Expand All @@ -35,19 +35,19 @@ There are 3 main types of HRP for the `Addresses`/`PubKeys` available by default

| | Address bech32 Prefix | Pubkey bech32 Prefix | Curve | Address byte length | Pubkey byte length |
|--------------------|-----------------------|----------------------|-----------------|---------------------|--------------------|
| Accounts | `eth` | `ethpub` | `eth_secp256k1` | `20` | `33` (compressed) |
| Validator Operator | `ethvaloper` | `ethvaloperpub` | `eth_secp256k1` | `20` | `33` (compressed) |
| Consensus Nodes | `ethvalcons` | `ethvalconspub` | `ed25519` | `20` | `32` |
| Accounts | `ethm` | `ethpub` | `eth_secp256k1` | `20` | `33` (compressed) |
| Validator Operator | `ethmvaloper` | `ethmvaloperpub` | `eth_secp256k1` | `20` | `33` (compressed) |
| Consensus Nodes | `ethmvalcons` | `ethmvalconspub` | `ed25519` | `20` | `32` |

## Address formats for clients

`EthAccount` can be represented in both [Bech32](https://en.bitcoin.it/wiki/Bech32) (`eth1...`) and hex (`0x...`) formats for Ethereum's Web3 tooling compatibility.
`EthAccount` can be represented in both [Bech32](https://en.bitcoin.it/wiki/Bech32) (`ethm1...`) and hex (`0x...`) formats for Ethereum's Web3 tooling compatibility.

The Bech32 format is the default format for Cosmos-SDK queries and transactions through CLI and REST
clients. The hex format on the other hand, is the Ethereum `common.Address` representation of a
Cosmos `sdk.AccAddress`.

- **Address (Bech32)**: `eth14au322k9munkmx5wrchz9q30juf5wjgz2cfqku`
- **Address (Bech32)**: `ethm14au322k9munkmx5wrchz9q30juf5wjgz2cfqku`
- **Address ([EIP55](https://eips.ethereum.org/EIPS/eip-55) Hex)**: `0xAF79152AC5dF276D9A8e1E2E22822f9713474902`
- **Compressed Public Key**: `{"@type":"/ethermint.crypto.v1beta1.ethsecp256k1.PubKey","key":"ApNNebT58zlZxO2yjHiRTJ7a7ufjIzeq5HhLrbmtg9Y/"}`

Expand All @@ -56,18 +56,18 @@ Cosmos `sdk.AccAddress`.
The `ethermintd debug addr <address>` can be used to convert an address between hex and bech32 formats. For example:

```bash
ethermintd debug addr eth10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
ethermintd debug addr ethm10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
Address bytes: [124 182 29 65 23 174 49 161 46 57 58 28 250 59 172 102 100 129 208 46]
Address (hex): 7CB61D4117AE31A12E393A1CFA3BAC666481D02E
Address (EIP-55): 0x7cB61D4117AE31a12E393a1Cfa3BaC666481D02E
Bech32 Acc: eth10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
Bech32 Acc: ethm10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
Bech32 Val: ethvaloper10jmp6sgh4cc6zt3e8gw05wavvejgr5pw5wdauz

ethermintd debug addr 0x7cB61D4117AE31a12E393a1Cfa3BaC666481D02E
Address bytes: [124 182 29 65 23 174 49 161 46 57 58 28 250 59 172 102 100 129 208 46]
Address (hex): 7CB61D4117AE31A12E393A1CFA3BAC666481D02E
Address (EIP-55): 0x7cB61D4117AE31a12E393a1Cfa3BaC666481D02E
Bech32 Acc: eth10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
Bech32 Acc: ethm10jmp6sgh4cc6zt3e8gw05wavvejgr5pw2unfju
Bech32 Val: ethvaloper10jmp6sgh4cc6zt3e8gw05wavvejgr5pw5wdauz
```

Expand All @@ -84,7 +84,7 @@ obtain the addresses and keys as mentioned above,
ethermintd keys show mykey --bech acc
- name: mykey
type: local
address: eth1qsklxwt77qrxur494uvw07zjynu03dq9alwh37
address: ethm1qsklxwt77qrxur494uvw07zjynu03dq9alwh37
pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"A8nbJ3eW9oAb2RNZoS8L71jFMfjk6zVa1UISYgKK9HPm"}'
mnemonic: ""

Expand Down Expand Up @@ -126,7 +126,7 @@ ethermintd q auth account $(ethermintd keys show <MYKEY> -a) -o text

``` bash
# GET /cosmos/auth/v1beta1/accounts/{address}
curl -X GET "http://localhost:10337/cosmos/auth/v1beta1/accounts/eth14au322k9munkmx5wrchz9q30juf5wjgz2cfqku" -H "accept: application/json"
curl -X GET "http://localhost:10337/cosmos/auth/v1beta1/accounts/ethm14au322k9munkmx5wrchz9q30juf5wjgz2cfqku" -H "accept: application/json"
```

### JSON-RPC
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/validators/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ We view testnet participation as a great way to signal to the community that you
In short, there are two types of keys:

- **Tendermint Key**: This is a unique key used to sign consensus votes.
- It is associated with a public key `ethvalconspub` (Get this value with `ethermintd tendermint show-validator`)
- It is associated with a public key `ethmvalconspub` (Get this value with `ethermintd tendermint show-validator`)
- It is generated when the node is created with `ethermintd init`.
- **Application key**: This key is created from `ethermintd` and used to sign transactions. Application keys are associated with a public key prefixed by `ethpub` and an address prefixed by `eth`. Both are derived from account keys generated by `ethermintd keys add`.
- **Application key**: This key is created from `ethermintd` and used to sign transactions. Application keys are associated with a public key prefixed by `ethpub` and an address prefixed by `ethm`. Both are derived from account keys generated by `ethermintd keys add`.

Note: A validator's operator key is directly tied to an application key, but
uses reserved prefixes solely for this purpose: `ethvaloper` and `ethvaloperpub`
uses reserved prefixes solely for this purpose: `ethmvaloper` and `ethmvaloperpub`

### What are the different states a validator can be in?

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/validators/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ To run testnet nodes, you will need a machine with the following minimum require

## Create Your Validator

Your `ethvalconspub` can be used to create a new validator by staking tokens. You can find your validator pubkey by running:
Your `ethmvalconspub` can be used to create a new validator by staking tokens. You can find your validator pubkey by running:

```bash
ethermintd tendermint show-validator
Expand Down Expand Up @@ -80,7 +80,7 @@ You can confirm that you are in the validator set by using a third party explore
If you want to participate in genesis as a validator, you need to justify that
you have some stake at genesis, create one (or multiple) transactions to bond this stake to your validator address, and include this transaction in the genesis file.

Your `ethvalconspub` can be used to create a new validator by staking tokens. You can find your validator pubkey by running:
Your `ethmvalconspub` can be used to create a new validator by staking tokens. You can find your validator pubkey by running:

```bash
ethermintd tendermint show-validator
Expand Down
12 changes: 6 additions & 6 deletions docs/quickstart/interact_node.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ There are multiple ways to interact with a node: using the CLI, using gRPC or us
Now that your very own node is running, it is time to try sending tokens from the first account you created to a second account. In a new terminal window, start by running the following query command:

```bash
ethermintd query bank balances $MY_VALIDATOR_ADDRESS --chain-id=ethermintd-1
ethermintd query bank balances $MY_VALIDATOR_ADDRESS --chain-id=ethermint_9000-1
```

You should see the current balance of the account you created, equal to the original balance of `eth` you granted it minus the amount you delegated via the `gentx`. Now, create a second account:
You should see the current balance of the account you created, equal to the original balance of tokens you granted it minus the amount you delegated via the `gentx`. Now, create a second account:

```bash
ethermintd keys add recipient --keyring-backend=file
Expand All @@ -26,19 +26,19 @@ RECIPIENT=$(ethermintd keys show recipient -a --keyring-backend=file)
The command above creates a local key-pair that is not yet registered on the chain. An account is created the first time it receives tokens from another account. Now, run the following command to send tokens to the `recipient` account:

```bash
ethermintd tx bank send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000000aphoton --chain-id=ethermintd-1 --keyring-backend=file
ethermintd tx bank send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000000aphoton --chain-id=ethermint_9000-1 --keyring-backend=file

# Check that the recipient account did receive the tokens.
ethermintd query bank balances $RECIPIENT --chain-id=ethermintd-1
ethermintd query bank balances $RECIPIENT --chain-id=ethermint_9000-1
```

Finally, delegate some of the stake tokens sent to the `recipient` account to the validator:

```bash
ethermintd tx staking delegate $(ethermintd keys show my_validator --bech val -a --keyring-backend=file) 500aphoton --from=recipient --chain-id=ethermintd-1 --keyring-backend=file
ethermintd tx staking delegate $(ethermintd keys show my_validator --bech val -a --keyring-backend=file) 500aphoton --from=recipient --chain-id=ethermint_9000-1 --keyring-backend=file

# Query the total delegations to `validator`.
ethermintd query staking delegations-to $(ethermintd keys show my_validator --bech val -a --keyring-backend=file) --chain-id=ethermintd-1
ethermintd query staking delegations-to $(ethermintd keys show my_validator --bech val -a --keyring-backend=file) --chain-id=ethermint_9000-1
```

You should see two delegations, the first one made from the `gentx`, and the second one you just performed from the `recipient` account.
Expand Down
18 changes: 9 additions & 9 deletions tests/solidity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ When in doubt, you can also run the tests against a Ganache instance via `yarn t

The [`init-test-node.sh`](./init-test-node.sh) script sets up ethermint with the following accounts:

- `eth18de995q8qk0leqk3d5pzmg7tlxvj6tmsku084d` (Validator)
- `0x3b7252d007059ffc82d16d022da3cbf9992d2f70`
- `eth1mhtyk3cj7ly0rt8rc9zuj5pnnmw67gsapygwyq` (User 1)
- `0xddd64b4712f7c8f1ace3c145c950339eddaf221d`
- `eth1pa20g7lehr330vs5ent20slr3wyne4lsy8qae3` (user 2)
- `0x0f54f47bf9b8e317b214ccd6a7c3e38b893cd7f0`
- `ethm10jmp6sgh4cc6zt3e8gw05wavvejgr5pwtu750w` (Validator)
- `0x7cB61D4117AE31a12E393a1Cfa3BaC666481D02E`
- `ethm1cml96vmptgw99syqrrz8az79xer2pcgp767p9e` (User 1)
- `0xC6Fe5D33615a1C52c08018c47E8Bc53646A0E101`
- `ethm1jcltmuhplrdcwp7stlr4hlhlhgd4htqhgjpff2` (user 2)
- `0x963EBDf2e1f8DB8707D05FC75bfeFFBa1B5BaC17`

Each with roughly 100 ETH available (1e18 photon).

Expand All @@ -63,19 +63,19 @@ Running `ethermintd keys list --keyring-backend=test` should output:
{
"name": "localkey",
"type": "local",
"address": "eth18de995q8qk0leqk3d5pzmg7tlxvj6tmsku084d",
"address": "ethm18de995q8qk0leqk3d5pzmg7tlxvj6tmsku084d",
"pubkey": "ethpub1pfqnmk6pq3ycjs34vv4n6rkty89f6m02qcsal3ecdzn7a3uunx0e5ly0846pzg903hxf2zp5gq4grh8jcatcemfrscdfl797zhg5crkcsx43gujzppge3n"
},
{
"name": "user1",
"type": "local",
"address": "eth1mhtyk3cj7ly0rt8rc9zuj5pnnmw67gsapygwyq",
"address": "ethm1mhtyk3cj7ly0rt8rc9zuj5pnnmw67gsapygwyq",
"pubkey": "ethpub1pfqnmk6pq3wrkx6lh7uug8ss0thggact3n49m5gkmpca4vylldpur5qrept57e0rrxfmeq5mp5xt3cyf4kys53qcv66qxttv970das69hlpkf8cnyd2a2x"
},
{
"name": "user2",
"type": "local",
"address": "eth1pa20g7lehr330vs5ent20slr3wyne4lsy8qae3",
"address": "ethm1pa20g7lehr330vs5ent20slr3wyne4lsy8qae3",
"pubkey": "ethpub1pfqnmk6pq3art9y45zw5ntyktt2qrt0skmsl0ux9qwk8458ed3d8sgnrs99zlgvj3rt2vggvkh0x56hffugwsyddwqla48npx46pglgs6xhcqpall58tgn"
}
]
Expand Down