-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3act.js
58 lines (34 loc) · 1.33 KB
/
3act.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
57
58
var Web3=require('web3');
const { promises } = require('dns');
function sleep(milliseconds) {
let timeStart = new Date().getTime();
while (true) {
let elapsedTime = new Date().getTime() - timeStart;
if (elapsedTime > milliseconds) {
break;
}
}
}
var web3=new Web3(Web3.givenProvider || "http://127.0.0.1:8545/");
web3.eth.getBlockNumber().then((bn)=>{
console.log(bn);
for(var i=11000;i<13000;i++)
{
web3.eth.getBlock(i).then((block)=>
{
if(block.transactions){
block.transactions.forEach((hash)=>
{
web3.eth.getTransaction(hash).then((t)=>
{
console.log(t.blockNumber+" "+ t.to);
});
sleep(10)
});
}
}).catch((err)=>
{
console.log(err);
});
}
});