Skip to content

Commit bf21013

Browse files
authored
Merge pull request 0xPolygon#2664 from arash009/main
Heimdall v2 docs
2 parents ede1ece + 0f7187b commit bf21013

23 files changed

+76869
-1
lines changed
142 KB
Loading

docs/img/pos/checkpoint_flow.png

37.9 KB
Loading

docs/img/pos/stake_diagram.png

475 KB
Loading

docs/img/pos/stake_flow.png

97.3 KB
Loading

docs/img/pos/state_sync_flow.png

174 KB
Loading

docs/pos/architecture/heimdall_v2/authentication.md

Lines changed: 711 additions & 0 deletions
Large diffs are not rendered by default.

docs/pos/architecture/heimdall_v2/balance-transfers.md

Lines changed: 1027 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
# Chainmanager module
3+
4+
This document specifies an overview of the chain manager module of Heimdall.
5+
6+
## Overview
7+
8+
The chainmanager module is responsible for fetching the PoS protocol parameters.
9+
These params include addresses of contracts deployed on mainchain (Ethereum) and bor chain (Bor),
10+
chain ids, mainchain and bor chain confirmation blocks.
11+
12+
```protobuf
13+
message ChainParams {
14+
option (gogoproto.equal) = true;
15+
string bor_chain_id = 1 [ (amino.dont_omitempty) = true ];
16+
string heimdall_chain_id = 2 [ (amino.dont_omitempty) = true ];
17+
string pol_token_address = 3 [ (amino.dont_omitempty) = true ];
18+
string staking_manager_address = 4 [ (amino.dont_omitempty) = true ];
19+
string slash_manager_address = 5 [ (amino.dont_omitempty) = true ];
20+
string root_chain_address = 6 [ (amino.dont_omitempty) = true ];
21+
string staking_info_address = 7 [ (amino.dont_omitempty) = true ];
22+
string state_sender_address = 8 [ (amino.dont_omitempty) = true ];
23+
string state_receiver_address = 9 [ (amino.dont_omitempty) = true ];
24+
string validator_set_address = 10 [ (amino.dont_omitempty) = true ];
25+
}
26+
27+
message Params {
28+
option (gogoproto.equal) = true;
29+
ChainParams chain_params = 1
30+
[ (amino.dont_omitempty) = true, (gogoproto.nullable) = false ];
31+
uint64 main_chain_tx_confirmations = 2 [ (amino.dont_omitempty) = true ];
32+
uint64 bor_chain_tx_confirmations = 3 [ (amino.dont_omitempty) = true ];
33+
}
34+
```
35+
36+
## Query commands
37+
38+
One can run the following query commands from the chainmanager module :
39+
40+
* `params` - Fetch the parameters associated with the chainmanager module.
41+
42+
### CLI commands
43+
44+
```bash
45+
heimdalld query chainmanager params
46+
```
47+
48+
### GRPC Endpoints
49+
50+
```bash
51+
grpcurl -plaintext -d '{}' localhost:9090 heimdallv2.chainmanager.Query/GetChainManagerParams
52+
53+
```
54+
55+
### REST endpoints
56+
57+
```bash
58+
curl localhost:1317/heimdallv2/chainmanager/params
59+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
3+
# Heimdall v2 changes compared to v1
4+
5+
There are a number of differences between Heimdall v1 to v2. These changes are outlined below:
6+
7+
## Encoding changes to Base64
8+
9+
Data encoding format has been changed from Hex encoded to Base64 encoded, for example:
10+
11+
Hex encoded: `BJSk2KCI4snP2Cw/ntDdgp8R25XJ2xg18KL67fyEAwgtPMpeq5APSUHrkv5wtgrFfpmcDivnP8HPGufyyXnByxo=`
12+
13+
Base64 encoded: `0x0494a4d8a088e2c9cfd82c3f9ed0dd829f11db95c9db1835f0a2faedfc8403082d3cca5eab900f4941eb92fe70b60ac57e999c0e2be73fc1cf1ae7f2c979c1cb1a`
14+
15+
## Validator signing key
16+
In Heimdall v2, validator signing keys must be imported into the keyring for transaction signing. For details of keyring, refer to the Cosmos SDK documentation [here](https://docs.cosmos.network/v0.46/run-node/keyring.html)
17+
18+
From the Cosmos documentation:
19+
20+
>The keyring holds the private/public keypairs used to interact with a node. For instance, >a validator key needs to be set up before running the blockchain node, so that blocks can >be correctly signed. The private key can be stored in different locations, called >"backends", such as a file or the operating system's own key storage.
21+
22+
### How to use Keyring
23+
24+
Below are the instructions on how to import your validator private key into the keyring and use it to sign transactions.
25+
26+
Get your `base64` encoded private key from:
27+
28+
```cat /var/lib/heimdall/config/priv_validator_key.json```
29+
30+
Convert the `base64` encoded key to hex encoded key:
31+
32+
```echo "<PRIVATE_KEY_BASE64_ENCODED>" | base64 -d | xxd -p -c 256```
33+
34+
Import the `hex` encoded key to your keyring:
35+
36+
```heimdalld keys import-hex <KEY_NAME> <PRIVATE_KEY_HEX_ENCODED> --home <HOME_DIR_PATH>```
37+
38+
When you first import a key into the keyring, you will be prompted for a password, which will be used every time you sign a transaction.
39+
40+
When running a `tx` command, just specify the `--from` argument, by using the name of the key you have set above. Example:
41+
```heimdalld tx gov vote 1 yes --from <KEY_NAME>```
42+
43+
## Vote extension in each block
44+
45+
In Heimdall v2, the first transaction of each block will contain the encoded vote extensions. To decode these, use the additional command in `heimdallld`

0 commit comments

Comments
 (0)