Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# `bfa.py`
Script en Python que reporta distintos datos sobre la BFA
Este _script_ requiere Python 3 y la biblioteca web3 (que puede instalarse con `pip`).
Para funcionar requiere conocer el directorio donde está el _socket_ `geth.ipc` (asume que es `${BFANETWORKDIR}/node/geth.ipc` o, en su defecto `~/bfa/network/node/geth.ipc`), y el puerto RPC (asume que es el 8545). Ambos valores pueden especificarse en la línea de comandos.
También puede usarse como biblioteca. La clase BFA tiene un conjunto de métodos que permiten obtener información de un nodo `geth`.
```
bfa@bootnode:~$ bfa.py
usage: bfa.py [-h] {signers,sealers,votes,proposals,block} ...
bfa.py: error: the following arguments are required: command
bfa@bootnode:~$ bfa.py --help
usage: bfa.py [-h] {signers,sealers,votes,proposals,block} ...
Proporciona información acerca de la Blockchain Federal Argentina
positional arguments:
{signers,sealers,votes,proposals,block}
Consulta a realizar
signers (sealers) Información sobre selladores
votes (proposals) Indica el estado de una votación
block Información sobre un bloque
optional arguments:
-h, --help show this help message and exit
bfa@bootnode:~$
```
El comando `signers` (o `sealers`) permite obtener información sobre los selladores (similar al script `sealer_status`.
```
bfa@bootnode:~$ bfa.py signers
0x19fe7b9b3a1bebde77c5374c8e13c623e3d1b5b2
0x2388d2cdb2cd6e7722b4af39c3bb406dd31f560e
0x2feb6a8876bd9e2116b47834b977506a08ea77bd
0x342e1d075d820ed3f9d9a05967ec4055ab23fa1e
0x39170a1ce03729d141dfaf8077c08b72c9cfdd0c
0x401d7a8432caa1025d5f093276cc6ec957b87c00
0x46991ada2a2544468eb3673524641bf293f23ccc
0x609043ebde4a06bd28a1de238848e8f82cca9c23
0x91c055c6478bd0ad6d19bcb58f5e7ca7b04e67f1
0x998c2651db6f76ca568c0071667d265bcc1b1e98
0x9b3ac6719b02ec7bb4820ae178d31c0bbda3a4e0
0xc0310a7b3b25f49b11b901a667208a3eda8d7ceb
bfa@bootnode:~$ bfa.py signers --help
usage: bfa.py signers [-h] [--ipc-path IPC_PATH] [--rpc-port RPC_PORT]
[--json] [--status] [--use-block-number]
[--blocks BLOCKS]
optional arguments:
-h, --help show this help message and exit
--ipc-path IPC_PATH Path del archivo geth.ipc. Default:
/home/bfa/bfa/network/node/geth.ipc
--rpc-port RPC_PORT Puerto RPC. Default: 8545
--json Produce salida en formato JSON
--status Indica cuantos bloques han pasado desde último sellado
por cada sellador (-1 si no está activo)
--use-block-number Indica el número de bloque en lugar de los bloques
transcurridos
--blocks BLOCKS Especifica cuantos bloques buscar hacia atrás (default:
5 *número_de_selladores)
bfa@bootnode:~$ bfa.py signers --status
0x19fe7b9b3a1bebde77c5374c8e13c623e3d1b5b2: 7
0x2388d2cdb2cd6e7722b4af39c3bb406dd31f560e: -1
0x2feb6a8876bd9e2116b47834b977506a08ea77bd: 8
0x342e1d075d820ed3f9d9a05967ec4055ab23fa1e: 4
0x39170a1ce03729d141dfaf8077c08b72c9cfdd0c: 3
0x401d7a8432caa1025d5f093276cc6ec957b87c00: -1
0x46991ada2a2544468eb3673524641bf293f23ccc: 1
0x609043ebde4a06bd28a1de238848e8f82cca9c23: 0
0x91c055c6478bd0ad6d19bcb58f5e7ca7b04e67f1: 2
0x998c2651db6f76ca568c0071667d265bcc1b1e98: 6
0x9b3ac6719b02ec7bb4820ae178d31c0bbda3a4e0: 5
0xc0310a7b3b25f49b11b901a667208a3eda8d7ceb: 12
bfa@bootnode:~$
```
Se puede pedir que la salida sea en formato JSON:
```
bfa@bootnode:~$ bfa.py signers --status --json
{
"0x19fe7b9b3a1bebde77c5374c8e13c623e3d1b5b2": 3,
"0x2388d2cdb2cd6e7722b4af39c3bb406dd31f560e": -1,
"0x2feb6a8876bd9e2116b47834b977506a08ea77bd": 9,
"0x342e1d075d820ed3f9d9a05967ec4055ab23fa1e": 10,
"0x39170a1ce03729d141dfaf8077c08b72c9cfdd0c": 0,
"0x401d7a8432caa1025d5f093276cc6ec957b87c00": -1,
"0x46991ada2a2544468eb3673524641bf293f23ccc": 4,
"0x609043ebde4a06bd28a1de238848e8f82cca9c23": 6,
"0x91c055c6478bd0ad6d19bcb58f5e7ca7b04e67f1": 7,
"0x998c2651db6f76ca568c0071667d265bcc1b1e98": 1,
"0x9b3ac6719b02ec7bb4820ae178d31c0bbda3a4e0": 5,
"0xc0310a7b3b25f49b11b901a667208a3eda8d7ceb": 2
}
bfa@bootnode:~$
```
El comando `votes` (o `proposals`) brinda información sobre el estado de una votación (es similar al script `vote_status`:
```
bfa@bootnode:~$ bfa.py votes
Bloque: 538426
Propuestas en curso: 0
bfa@bootnode:~$
```
Se puede pedir el estado en un bloque determinado:
```
bfa@bootnode:~$ bfa.py votes --block-number 530000
Bloque: 530000
Propuestas en curso: 2
Propuesta: 0x2388d2cdb2cd6e7722b4af39c3bb406dd31f560e
0x19fe7b9b3a1bebde77c5374c8e13c623e3d1b5b2: None
0x2feb6a8876bd9e2116b47834b977506a08ea77bd: True
0x342e1d075d820ed3f9d9a05967ec4055ab23fa1e: None
0x39170a1ce03729d141dfaf8077c08b72c9cfdd0c: True
0x46991ada2a2544468eb3673524641bf293f23ccc: True
0x609043ebde4a06bd28a1de238848e8f82cca9c23: True
0x91c055c6478bd0ad6d19bcb58f5e7ca7b04e67f1: None
0x998c2651db6f76ca568c0071667d265bcc1b1e98: None
0x9b3ac6719b02ec7bb4820ae178d31c0bbda3a4e0: True
0xc0310a7b3b25f49b11b901a667208a3eda8d7ceb: None
A favor: 5, en contra: 0, no votaron: 5
Propuesta: 0x401d7a8432caa1025d5f093276cc6ec957b87c00
0x19fe7b9b3a1bebde77c5374c8e13c623e3d1b5b2: None
0x2feb6a8876bd9e2116b47834b977506a08ea77bd: True
0x342e1d075d820ed3f9d9a05967ec4055ab23fa1e: None
0x39170a1ce03729d141dfaf8077c08b72c9cfdd0c: True
0x46991ada2a2544468eb3673524641bf293f23ccc: True
0x609043ebde4a06bd28a1de238848e8f82cca9c23: True
0x91c055c6478bd0ad6d19bcb58f5e7ca7b04e67f1: None
0x998c2651db6f76ca568c0071667d265bcc1b1e98: None
0x9b3ac6719b02ec7bb4820ae178d31c0bbda3a4e0: True
0xc0310a7b3b25f49b11b901a667208a3eda8d7ceb: None
A favor: 5, en contra: 0, no votaron: 5
bfa@bootnode:~$
```
O, en formato JSON:
```
bfa@bootnode:~$ bfa.py votes --block-number 530000 --json
{
"block": 530000,
"proposals": [
"0x2388d2cdb2cd6e7722b4af39c3bb406dd31f560e",
"0x401d7a8432caa1025d5f093276cc6ec957b87c00"
],
"tally": {
"0x2388d2cdb2cd6e7722b4af39c3bb406dd31f560e": {
"None": 5,
"True": 5
},
"0x401d7a8432caa1025d5f093276cc6ec957b87c00": {
"None": 5,
"True": 5
}
},
"votes": {
"0x2388d2cdb2cd6e7722b4af39c3bb406dd31f560e": {
"0x19fe7b9b3a1bebde77c5374c8e13c623e3d1b5b2": null,
"0x2feb6a8876bd9e2116b47834b977506a08ea77bd": true,
"0x342e1d075d820ed3f9d9a05967ec4055ab23fa1e": null,
"0x39170a1ce03729d141dfaf8077c08b72c9cfdd0c": true,
"0x46991ada2a2544468eb3673524641bf293f23ccc": true,
"0x609043ebde4a06bd28a1de238848e8f82cca9c23": true,
"0x91c055c6478bd0ad6d19bcb58f5e7ca7b04e67f1": null,
"0x998c2651db6f76ca568c0071667d265bcc1b1e98": null,
"0x9b3ac6719b02ec7bb4820ae178d31c0bbda3a4e0": true,
"0xc0310a7b3b25f49b11b901a667208a3eda8d7ceb": null
},
"0x401d7a8432caa1025d5f093276cc6ec957b87c00": {
"0x19fe7b9b3a1bebde77c5374c8e13c623e3d1b5b2": null,
"0x2feb6a8876bd9e2116b47834b977506a08ea77bd": true,
"0x342e1d075d820ed3f9d9a05967ec4055ab23fa1e": null,
"0x39170a1ce03729d141dfaf8077c08b72c9cfdd0c": true,
"0x46991ada2a2544468eb3673524641bf293f23ccc": true,
"0x609043ebde4a06bd28a1de238848e8f82cca9c23": true,
"0x91c055c6478bd0ad6d19bcb58f5e7ca7b04e67f1": null,
"0x998c2651db6f76ca568c0071667d265bcc1b1e98": null,
"0x9b3ac6719b02ec7bb4820ae178d31c0bbda3a4e0": true,
"0xc0310a7b3b25f49b11b901a667208a3eda8d7ceb": null
}
}
}
bfa@bootnode:~$
```
El comando `block` permite ver un bloque, y adicionalmente, identificar el sellador de ese bloque:
```
bfa@bootnode:~$ bfa.py block --sealer
usage: bfa.py [-h] {signers,sealers,votes,proposals,block} ...
bfa.py: error: unrecognized arguments: --sealer
bfa@bootnode:~$ bfa.py block --signer
difficulty: 0x1
extraData: 0x393938633236353164623666373663613536382e303035303536396633313166
gasLimit: 8000000
gasUsed: 0
hash: 0xacd7427e4db75c65cd63a41defce7b6284797093d85cc3ba22e50519faee267b
logsBloom: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
miner: 0x0000000000000000000000000000000000000000
mixHash: 0x0000000000000000000000000000000000000000000000000000000000000000
nonce: 0x0000000000000000
number: 0x8389c
parentHash: 0xe6196028a81e9fae119b04d270b5b2f5c327d189d86358da9b8f29f40cb3d643
receiptsRoot: 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
sha3Uncles: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
signer: 0x998c2651db6f76ca568c0071667d265bcc1b1e98
size: 0x261
stateRoot: 0x343e9a5c6763047eb7c99aaab5bd3078bdcfda16f076fe5916eb2ea45f57715b
timestamp: 0x5bd7aefc
totalDifficulty: 0xd8bf3
transactions: []
transactionsRoot: 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
uncles: []
bfa@bootnode:~$
```