Splinterlands Move - STEEM blockchain BEFORE/AFTER

2020-06-02T23:25:57
Dear blockchain friends and Splinterlands fans,
With Spliterlands move to HIVE I was interested to see the immediate impact it had on the activities on the STEEM blockchain. I had no real idea of how big drop it would be, but I was impressed to see that the activities are down over 50%.
Please see the simple graph below. Each dot represents all operations per hour. I guess it goes without saying that Splinterlands move occurred around the time of that huge drop in the chart.
I put together a simple python script to check the number of operations on the STEEM blockchain, before and after Splinterlands move to HIVE. The data is between May 29 04:00 and June 2 20:00, UTC time.
I was using Beem to interact with the blockchain and matplotlib to render the graph.
Find below a copy of the script:
import time
import matplotlib.pyplot as plt
from datetime import datetime
from beem import Steem
from beem.blockchain import Blockchain
from beem.instance import set_shared_steem_instance

steem = Steem(['https://api.steemit.com'])
set_shared_steem_instance(steem)
chain = Blockchain()

def lineplot(x_data, y_data):
    plt.style.use('seaborn-whitegrid')
    plt.figure(figsize=(20, 10))
    ax = plt.axes()
    plt.plot(x_data, y_data, 'r-s', color = 'darkblue', linewidth=3, markersize=12, markeredgecolor='red')
    ax.set_title("Operations per Hour")
    ax.set_xlabel("Day-Hour")
    ax.set_ylabel("Nr of Ops")

start_time = time.time()
x_hour = []
y_ops = []
current_block = 43777926
hour_tag = "0"
ops_count = 0
for ops in chain.stream(start=current_block, max_batch_size=50):
    if hour_tag == "0":
        hour_tag = "{}-{}".format(ops['timestamp'].day, ops['timestamp'].hour)
    if "{}-{}".format(ops['timestamp'].day, ops['timestamp'].hour) == hour_tag:
        ops_count += 1
    else:
        print("Processing day-hour: {}".format(hour_tag))
        x_hour.append(hour_tag)
        y_ops.append(ops_count)
        ops_count = 1
        hour_tag = "{}-{}".format(ops['timestamp'].day, ops['timestamp'].hour)

print("Execution time: {} seconds".format(round((time.time() - start_time),2)))
lineplot(x_hour, y_ops)
Updated the script with the max_batch_size after optimization hint from @crokkon. Also added a print statement inside the loop to provide some feedback during execution. And added a total execution time.
Thanks for reading!
I wish you all a lovely day/evening/night!
211
21
11.63
21 Replies