Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update acc desc #31

Merged
merged 3 commits into from
Mar 17, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions docs/concepts/addr.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omi
}
````


```bash
# plugchaind q account gx1rpyxd0yqfkqcm8pmp0nejpeacd5t7usk26d2h2
# http://8.210.180.240:1317/cosmos/auth/v1beta1/accounts/gx1rpyxd0yqfkqcm8pmp0nejpeacd5t7usk26d2h2

'@type': /cosmos.auth.v1beta1.BaseAccount
account_number: "1"
address: gx1rpyxd0yqfkqcm8pmp0nejpeacd5t7usk26d2h2
pub_key:
'@type': /cosmos.crypto.secp256k1.PubKey
key: AlcccAL+NKRmkvu1Hvmt5uSDzXQEMmOhu7YPy1RwnaXU
sequence: "0"
```


- Hierarchical deterministic wallet based on [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki).
- BIP44 defines a logical hierarchy of deterministic wallets based on the algorithm described in [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), which allows the processing of multiple tokens , multiple accounts, external and internal chains per account, and millions of addresses per chain, such as Bitcoin and Ethereum.
- pubkey type `secp256k1` .
Expand All @@ -56,14 +71,30 @@ Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omi

### EthAccount

````go
```go
// EthAccount implements the authtypes. AccountI interface and embeds an
// authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.
type EthAccount struct {
*types.BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty" yaml:"base_account"`
CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty" yaml:"code_hash"`
}
````
```

```bash
# plugchaind q account gx1tr5gxpl3c78qp4xkkmhw5p9tmwruvte773ync5
# http://8.210.180.240:1317/cosmos/auth/v1beta1/accounts/gx1tr5gxpl3c78qp4xkkmhw5p9tmwruvte773ync5

'@type': /ethermint.types.v1.EthAccount
base_account:
account_number: "0"
address: gx1tr5gxpl3c78qp4xkkmhw5p9tmwruvte773ync5
pub_key:
'@type': /ethermint.crypto.v1.ethsecp256k1.PubKey
key: AmIFRfAboGW0P1GSG+8b9m8aMM1ikl4da4vEakglaLep
sequence: "1"
code_hash:0xc5d2440186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
```


- Use ETH's ECDSA secp256k1 curve as the key, which fully satisfies [EIP84](https://github.com/ethereum/EIPs/issues/84) [BIP44](https://github.com/bitcoin/bips/ blob/master/bip-0044.mediawiki) path.
- pubkey type `eth_secp256k1` .
Expand All @@ -90,8 +121,6 @@ client. On the other hand, the hex format is Ethereum's `common.Address`,
`plugchaind debug addr <address>` can be used to convert addresses between hex and bech32 formats. E.g:


:::: tabs
::: tab Bech32

```bash
plugchaind debug addr gx1z3t55m0l9h0eupuz3dp5t5cypyv674jj7mz2jw
Expand All @@ -100,8 +129,6 @@ plugchaind debug addr gx1z3t55m0l9h0eupuz3dp5t5cypyv674jj7mz2jw
Bech32 Acc: gx1z3t55m0l9h0eupuz3dp5t5cypyv674jj7mz2jw
Bech32 Val: gxvaloper1z3t55m0l9h0eupuz3dp5t5cypyv674jjn4d6nn
```
:::
::: tab Hex

```bash
plugchaind debug addr 14574A6DFF2DDF9E07828B4345D3040919AF5652
Expand Down
33 changes: 29 additions & 4 deletions docs/zh/concepts/addr.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ type BaseAccount struct {
}
```

```bash
# plugchaind q account gx1rpyxd0yqfkqcm8pmp0nejpeacd5t7usk26d2h2
# http://8.210.180.240:1317/cosmos/auth/v1beta1/accounts/gx1rpyxd0yqfkqcm8pmp0nejpeacd5t7usk26d2h2

'@type': /cosmos.auth.v1beta1.BaseAccount
account_number: "1"
address: gx1rpyxd0yqfkqcm8pmp0nejpeacd5t7usk26d2h2
pub_key:
'@type': /cosmos.crypto.secp256k1.PubKey
key: AlcccAL+NKRmkvu1Hvmt5uSDzXQEMmOhu7YPy1RwnaXU
sequence: "0"
```


- 基于[BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)的分层确定性钱包。
- BIP44基于[BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)中描述的算法定义确定性钱包的逻辑层次结构,该算法允许处理多种代币,多个帐户,每个帐户的外部和内部链以及每个链的数百万个地址,例如比特币和以太坊。
- pubkey类型 `secp256k1` 。
Expand All @@ -69,6 +83,21 @@ type EthAccount struct {
}
```

```bash
# plugchaind q account gx1tr5gxpl3c78qp4xkkmhw5p9tmwruvte773ync5
# http://8.210.180.240:1317/cosmos/auth/v1beta1/accounts/gx1tr5gxpl3c78qp4xkkmhw5p9tmwruvte773ync5

'@type': /ethermint.types.v1.EthAccount
base_account:
account_number: "0"
address: gx1tr5gxpl3c78qp4xkkmhw5p9tmwruvte773ync5
pub_key:
'@type': /ethermint.crypto.v1.ethsecp256k1.PubKey
key: AmIFRfAboGW0P1GSG+8b9m8aMM1ikl4da4vEakglaLep
sequence: "1"
code_hash:0xc5d2440186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
```

- 使用ETH的ECDSA secp256k1曲线作为密钥,这完全满足 [EIP84](https://github.com/ethereum/EIPs/issues/84) [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) 路径。
- pubkey类型 `eth_secp256k1` 。
- 帐户的根 HD 路径是 `m/44'/60'/0'/0`。
Expand All @@ -94,8 +123,6 @@ Cosmos的 `sdk.AccAddress`。
可使用 `plugchaind debug addr <address>` 用于在 hex 和 bech32 格式之间转换地址。例如:


:::: tabs
::: tab Bech32

```bash
plugchaind debug addr gx1z3t55m0l9h0eupuz3dp5t5cypyv674jj7mz2jw
Expand All @@ -104,8 +131,6 @@ plugchaind debug addr gx1z3t55m0l9h0eupuz3dp5t5cypyv674jj7mz2jw
Bech32 Acc: gx1z3t55m0l9h0eupuz3dp5t5cypyv674jj7mz2jw
Bech32 Val: gxvaloper1z3t55m0l9h0eupuz3dp5t5cypyv674jjn4d6nn
```
:::
::: tab Hex

```bash
plugchaind debug addr 14574A6DFF2DDF9E07828B4345D3040919AF5652
Expand Down