@@ -4,9 +4,11 @@ This repository contains a set of tools designed for BIFROST network.
44
55It is written in typescript, using ` yargs ` as interactive CLI tool.
66
7- ## CLI Tools
7+ # CLI Tools
88
9- ### 1. Generate your required validator accounts
9+ ## 1. Node Setup
10+
11+ ### 1.1. Generate your required validator accounts
1012
1113** Full Nodes**
1214
@@ -20,14 +22,14 @@ npm run create_accounts -- --full
2022npm run create_accounts
2123```
2224
23- ### 2. Set your node session keys
25+ ### 1. 2. Set your node session keys
2426
2527```
2628npm run set_session_keys -- \
2729 --controllerPrivate 0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133
2830```
2931
30- ### 3. Self bond your initial stake and join as a Validator
32+ ### 1. 3. Self bond your initial stake and join as a Validator
3133
3234** Full Node**
3335
@@ -47,3 +49,138 @@ npm run join_validators -- \
4749 --stashPrivate 0x234871e7f7520af0cfc9f8547057b283c628be93a90b393aa19be1279ee52b4a \
4850 --bond 1000
4951```
52+
53+ ## 2. Data Query
54+
55+ ### 1.1. Query Extrinsics
56+ This command will query historical extrinsics that matches the requested parameters.
57+
58+ ** Query Parameters**
59+ | Name | Description | Example | Required |
60+ | ----------| --------------------------------------------| --------------------------------------------------------------------| ------------------------------------------------------|
61+ | from | The account address who submitted the extrinsic. | 0x81143D1d29B101B84FE87BCB2f684534b20EBaAd | X|
62+ | start | The starting block number where query will start. | 5047917 | O|
63+ | end | The ending block number where the query will end. The default value will be the highest block of the connected provider. | 5048007 | X|
64+ | provider | The provider URL. The default value will be ` http://localhost:9933 ` | ` https://public-01.testnet.thebifrost.io/rpc ` | O|
65+ | pallet | The name of the pallet where the extrinsic locates. | bfcStaking | O|
66+ | extrinsic | The name of the extrinsic to query. | nominate | O|
67+
68+ ** Example Request**
69+ ```
70+ npm run query_extrinsics -- \
71+ --from 0x81143D1d29B101B84FE87BCB2f684534b20EBaAd \
72+ --start 5047917 \
73+ --end 5048007 \
74+ --provider https://public-01.testnet.thebifrost.io/rpc \
75+ --pallet bfcStaking \
76+ --extrinsic nominate
77+ ```
78+
79+ ** Example Response**
80+ ```
81+ ✨ Found extrinsics in block #5047917
82+ 🔖 Extrinsic #5047917-1 hash(0x38aed5995f65f9fa49c4387ad7c5302b6c7e27443ca986e7c7861d429a34665b)
83+ ```
84+
85+ ### 1.2. Query Events
86+ This command will query historical events that matches the requested parameters.
87+
88+ ** Query Parameters**
89+ | Name | Description | Example | Required |
90+ | ----------| --------------------------------------------| --------------------------------------------------------------------| ------------------------------------------------------|
91+ | start | The starting block number where query will start. | 5047917 | O|
92+ | end | The ending block number where the query will end. The default value will be the highest block of the connected provider. | 5048007 | X|
93+ | provider | The provider URL. The default value will be ` http://localhost:9933 ` | ` https://public-01.testnet.thebifrost.io/rpc ` | O|
94+ | pallet | The name of the pallet where the event locates. | bfcStaking | O|
95+ | event | The name of the event to query. | Nomination | O|
96+
97+ ** Example Request**
98+ ```
99+ npm run query_events -- \
100+ --start 5047917 \
101+ --end 5048007 \
102+ --provider https://public-01.testnet.thebifrost.io/rpc \
103+ --pallet bfcStaking \
104+ --event Nomination
105+ ```
106+
107+ ** Example Response**
108+ ```
109+ ✨ Found events in block #5047917
110+ 🔖 Event emitted at extrinsic #5047917-1 hash(0x38aed5995f65f9fa49c4387ad7c5302b6c7e27443ca986e7c7861d429a34665b)
111+ ```
112+
113+ ### 1.3. Query Extrinsic Details
114+ This command will query the detail information of the extrinsic that matches the requested parameters.
115+
116+ ** Query Parameters**
117+ | Name | Description | Example | Required |
118+ | ----------| --------------------------------------------| --------------------------------------------------------------------| ------------------------------------------------------|
119+ | block | The block number where the extrinsic is included. | 5047917 | O|
120+ | index | The index of the extrinsic. | 1 | O|
121+ | provider | The provider URL. The default value will be ` http://localhost:9933 ` | ` https://public-01.testnet.thebifrost.io/rpc ` | O|
122+
123+ ** Example Request**
124+ ```
125+ npm run query_extrinsic -- \
126+ --block 5047917 \
127+ --index 1 \
128+ --provider https://public-01.testnet.thebifrost.io/rpc
129+ ```
130+
131+ ** Example Response**
132+ ```
133+ 🔖 Extrinsic #5047917-1 hash(0x38aed5995f65f9fa49c4387ad7c5302b6c7e27443ca986e7c7861d429a34665b)
134+ Pallet: bfcStaking
135+ Extrinsic: nominate
136+ Signer: 0x81143D1d29B101B84FE87BCB2f684534b20EBaAd
137+ Arguments:
138+ candidate: 0x45A96ACA1Cd759306B05B05b40B082254E77699b
139+ amount: 1,000,000,000,000,000,000,000
140+ candidate_nomination_count: 100
141+ nomination_count: 100
142+ Events:
143+ #0
144+ Pallet: balances
145+ Event: Withdraw
146+ Data:
147+ "0x81143D1d29B101B84FE87BCB2f684534b20EBaAd"
148+ "1,390,000,098,974,000"
149+ #1
150+ Pallet: balances
151+ Event: Reserved
152+ Data:
153+ "0x81143D1d29B101B84FE87BCB2f684534b20EBaAd"
154+ "1,000,000,000,000,000,000,000"
155+ #2
156+ Pallet: bfcStaking
157+ Event: Nomination
158+ Data:
159+ "0x81143D1d29B101B84FE87BCB2f684534b20EBaAd"
160+ "1,000,000,000,000,000,000,000"
161+ "0x45A96ACA1Cd759306B05B05b40B082254E77699b"
162+ {"AddedToTop":{"newTotal":"669,047,377,978,039,362,458,861"}}
163+ #3
164+ Pallet: balances
165+ Event: Deposit
166+ Data:
167+ "0x6d6f646C70792f74727372790000000000000000"
168+ "695,000,049,487,000"
169+ #4
170+ Pallet: treasury
171+ Event: Deposit
172+ Data:
173+ "695,000,049,487,000"
174+ #5
175+ Pallet: transactionPayment
176+ Event: TransactionFeePaid
177+ Data:
178+ "0x81143D1d29B101B84FE87BCB2f684534b20EBaAd"
179+ "1,390,000,098,974,000"
180+ "0"
181+ #6
182+ Pallet: system
183+ Event: ExtrinsicSuccess
184+ Data:
185+ {"weight":{"refTime":"1,283,734,000","proofSize":"0"},"class":"Normal","paysFee":"Yes"}
186+ ```
0 commit comments