-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathscout.py
36 lines (30 loc) · 993 Bytes
/
scout.py
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
import json
import requests
import matplotlib.pyplot as plt
from utils import deObfuscate as d
with open('config.json', 'r') as f:
config = json.load(f)
verbose = True
APIKEY = d(config["APIKEY"])
contract = "0xf08253ebb55c5da33d637ad201a00760776f1d3b"
startBlock = 5188000
txEndpoint = f"https://api.bscscan.com/api?module=account&action=txlist&address={contract}&startblock={startBlock}%20&endblock=99999999&sort=asc&apikey={APIKEY}"
def getResults(txEndpoint):
response = requests.get(txEndpoint)
response = json.loads(response.text)
return response["result"]
def getDistances():
results = getResults(txEndpoint)
dist = 0
prior = results[0]["blockNumber"]
distances = []
for x in (results[1:]):
dist = int(x["blockNumber"]) - int(prior)
prior = x["blockNumber"]
distances += [(x["blockNumber"], dist)]
x,y = zip(*distances)
plt.scatter(x, y)
plt.show()
plt.plot(x, y)
plt.show()
getDistances()