-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetcode.js
56 lines (49 loc) · 1.04 KB
/
getcode.js
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
const rp = require('request-promise');
var JSONbig = require('json-bigint');
const config = {
url: "http://34.87.16.107:46658/eth",
firstBlock: 1,
lastBlock: 100,
frequency: 1,
}
async function getCode() {
var options = {
method: 'POST',
uri: config.url,
body: {
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0xcc72490fd54c9a37D3aB33cEB03360A1A01920e1"
],
"id": 73
},
headers: {
"Content-type": "application/json; charset=UTF-8"
},
json: true
};
try {
const res = await rp(options);
console.log(res)
} catch (err) {
console.log(err)
return 0
}
}
async function hello() {
try {
for (i = 0; i < 100; i++) {
await getCode()
}
} catch (err) {
console.log("should not revert", err);
}
timeout();
}
function timeout() {
setTimeout(hello, 1000);
}
(async function () {
timeout();
})();