Sometimes, a small bug report can lead you down a deep rabbit hole. What starts as a "quick fix" spirals into a multi-day project. That's exactly what happened over the last couple of days, and I'm excited to share the results of a major refactor that will soon be proposed for the Hive-Engine `distribution-engine-smt`. #### The Problem It all started when I noticed that the rewards on the 1UP outpost weren't being reported correctly; they were just showing a zero balance.  My first step was to check the API call that the frontend uses. I tried it manually and was immediately greeted with a `500 Internal Server Error`. Well, that's definitely not good.  #### The Investigation This sent me digging into the source code of the `distribution-engine-smt` backend that Hive-Engine uses. What I found was... surprising. The code was still using the old **`beem`** library for its blockchain interactions. _Gasp!_ No wonder it wasn't working correctly. My initial thought was that I'd just do a quick update, swap it over to `hive-nectar`, and call it a day. But as I got deeper into the code, I realized that wasn't the only issue. Just like a lot of older codebases, it was using `datetime` objects that were not timezone-aware, had a lot of linting errors, and was cluttered with unused imports. #### The "Quick Fix" That Snowballed So, I started cleaning it up. I fixed the code, updated the libraries, and then it came time to build the database to see if my changes worked. The initial sync process was taking far too long, streaming the main Hive chain and the Hive-Engine sidechain block by block. To solve this, I added a batch mode to process the blocks in 1,000-block chunks. (You might remember me adding that bulk query feature to `nectarengine` recently... now you know why!) One thing led to another, and I ended up refactoring nearly the whole thing. The application now uses `StreamHandlers` for processing the blockchain and is, I feel, much easier to read and maintain. #### The Results And the results speak for themselves. After the refactor, the API call now works perfectly.  Most importantly, with the API now feeding it the correct data, the 1UP outpost is displaying the rewards properly!  I have a tiny bit more work to do to button everything up, and then I'll be submitting an official pull request to the Hive-Engine team. Hopefully, they accept it so everyone can benefit from a more stable and reliable SMT API. If you want to take a peek at it, have a gander at the [GitHub Dev Branch](https://github.com/TheCrazyGM/distribution-engine-smt/tree/dev). As always, Michael Garcia a.k.a. TheCrazyGM
author | thecrazygm | ||||||
---|---|---|---|---|---|---|---|
permlink | coming-soon-a-major-refactor-of-the-hive-engine-distribution-engine-smt-maybe | ||||||
category | hive-186392 | ||||||
json_metadata | {"app":"peakd/2025.7.3","format":"markdown","image":["https://files.peakd.com/file/peakd-hive/thecrazygm/23t8D6MsrmvtwBDKxExiUQYJzkLGbUzjuw1kdtL57dm7rfu8wmWt8WGP9nAVZtnBy9j3W.png","https://files.peakd.com/file/peakd-hive/thecrazygm/23t72wiabGmWrQ9mN6ckFGrqxx35ZmKhve5TFAVFjkb67UFSZTA5hBKZcvR6iHSY5yU5K.png","https://files.peakd.com/file/peakd-hive/thecrazygm/23swZX8rPywbbdt4JpTtD2ouobreByu388EZsB6vDT149W9RFXGhoT4p2a14cvpTZ1g23.png","https://files.peakd.com/file/peakd-hive/thecrazygm/23tHb6kpjALDMr6arRTZKSBJgDgX2SHCxsMN75Pjkn9RyjGhEqcnS8Hrchhzh8mxk6LPx.png"],"tags":["dev","hiveengine","scot","smt","tribes","archon","pimp","proofofbrain","oneup","arcadecolony"],"users":[]} | ||||||
created | 2025-07-20 13:13:39 | ||||||
last_update | 2025-07-20 14:43:54 | ||||||
depth | 0 | ||||||
children | 2 | ||||||
last_payout | 2025-07-27 13:13:39 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 18.920 HBD | ||||||
curator_payout_value | 22.232 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 3,207 | ||||||
author_reputation | 117,140,459,738,175 | ||||||
root_title | "Coming Soon: A Major Refactor of the Hive-Engine distribution-engine-smt, Maybe?" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 144,238,173 | ||||||
net_rshares | 134,202,694,550,525 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
blocktrades | 0 | 1,888,068,685,508 | 1.1% | ||
alpha | 0 | 3,325,316,285,377 | 1.1% | ||
kenny-crane | 0 | 911,656,370,179 | 50% | ||
roelandp | 0 | 3,884,528,397 | 0.27% | ||
jacor | 0 | 23,868,163,500 | 50% | ||
josepimpo | 0 | 11,853,810,548 | 25% | ||
clayboyn | 0 | 13,733,943,823 | 15% | ||
eforucom | 0 | 22,402,360,169 | 100% | ||
moretea | 0 | 3,347,578,325 | 10% | ||
gamer00 | 0 | 20,027,163,645 | 5% | ||
mes | 0 | 1,960,315,566,506 | 100% | ||
calmphoenix | 0 | 1,442,481,868 | 30% | ||
ecoinstant | 0 | 30,242,785,903 | 100% | ||
cryptoknight12 | 0 | 52,791,916,613 | 100% | ||
techken | 0 | 23,684,401,762 | 25% | ||
joeyarnoldvn | 0 | 449,682,162 | 1.47% | ||
eturnerx | 0 | 270,789,596,740 | 20.2% | ||
pixelfan | 0 | 50,090,646,759 | 5.8% | ||
likedeeler | 0 | 256,384,468,011 | 100% | ||
shanibeer | 0 | 1,089,765,066,226 | 35% | ||
hdmed | 0 | 5,305,921,188 | 50% | ||
enrique89 | 0 | 227,089,231,552 | 27.5% | ||
accelerator | 0 | 45,642,761,516 | 60% | ||
artlover | 0 | 1,692,338,389 | 100% | ||
tomiscurious | 0 | 26,502,950,758 | 4.5% | ||
therealwolf | 0 | 11,835,361,902 | 1.1% | ||
fatman | 0 | 9,270,499,872 | 2% | ||
votehero | 0 | 26,665,817,966 | 5.3% | ||
nnnarvaez | 0 | 1,411,847,266 | 27.5% | ||
sayee | 0 | 627,444,542 | 1.1% | ||
morwhale | 0 | 828,664,024 | 50% | ||
morwhaleplus | 0 | 589,085,850 | 50% | ||
coolguy123 | 0 | 2,825,514,691 | 1% | ||
morwhalebonus | 0 | 584,830,648 | 50% | ||
smartsteem | 0 | 52,346,605,489 | 1.1% | ||
mytechtrail | 0 | 20,165,458,250 | 15% | ||
jozefkrichards | 0 | 5,102,232,578 | 50% | ||
yousafharoonkhan | 0 | 78,751,839,398 | 53% | ||
sneakyninja | 0 | 16,994,940,502 | 24.88% | ||
najat | 0 | 3,083,780,761 | 50% | ||
steembasicincome | 0 | 4,996,236,963,705 | 100% | ||
gabrielatravels | 0 | 998,340,177 | 0.55% | ||
hetty-rowan | 0 | 43,952,340,766 | 50% | ||
irisworld | 0 | 1,182,398,688 | 7.5% | ||
bengy | 0 | 2,737,154,320 | 3% | ||
blocktrades.com | 0 | 1,209,649,915,232 | 1.1% | ||
aakom | 0 | 451,723,016 | 100% | ||
danielcarrerag | 0 | 15,302,519,281 | 27.5% | ||
gaeljosser | 0 | 1,810,346,781 | 27.5% | ||
anikys3reasure | 0 | 2,304,501,603 | 50% | ||
victoriabsb | 0 | 2,158,297,762 | 30% | ||
antoniarhuiz | 0 | 1,357,059,142 | 2.75% | ||
abrockman | 0 | 3,192,882,128,209 | 100% | ||
sbi2 | 0 | 3,311,380,272,261 | 100% | ||
dera123 | 0 | 38,755,157,578 | 100% | ||
awesomegames007 | 0 | 1,297,886,810 | 50% | ||
gadrian | 0 | 601,572,435,442 | 40% | ||
sbi3 | 0 | 1,661,808,058,424 | 100% | ||
beco132 | 0 | 1,958,842,209 | 54% | ||
huesos | 0 | 820,474,828 | 27.5% | ||
sbi4 | 0 | 1,051,913,407,692 | 100% | ||
fw206 | 0 | 2,673,721,772,436 | 31% | ||
netzisde | 0 | 3,563,335,960 | 100% | ||
juliopalomo | 0 | 2,524,575,208 | 27.5% | ||
aliento | 0 | 1,460,617,811,799 | 55% | ||
bububoomt | 0 | 5,598,824,321 | 100% | ||
sbi5 | 0 | 843,582,141,328 | 100% | ||
sbi6 | 0 | 655,127,753,456 | 100% | ||
gorayii | 0 | 14,675,578,926 | 27.5% | ||
smartvote | 0 | 134,875,158,089 | 6.2% | ||
sbi7 | 0 | 490,087,416,132 | 100% | ||
tdas0 | 0 | 2,078,088,296 | 50% | ||
voxmortis | 0 | 11,236,945,985 | 6% | ||
pboulet | 0 | 211,680,017,860 | 100% | ||
a-bot | 0 | 14,970,517,309 | 30% | ||
voter001 | 0 | 26,973,054,781 | 25.4% | ||
mk992039 | 0 | 746,169,199 | 4% | ||
guurry123 | 0 | 7,212,184,699 | 10% | ||
ecoinstats | 0 | 66,960,561,589 | 100% | ||
sbi8 | 0 | 359,220,019,486 | 100% | ||
thevil | 0 | 5,988,613,166 | 0.55% | ||
piestrikesback | 0 | 655,011,292 | 100% | ||
sbi9 | 0 | 257,087,429,759 | 100% | ||
buildingpies | 0 | 52,300,455,791 | 100% | ||
sbi10 | 0 | 198,312,044,325 | 100% | ||
sextories | 0 | 474,863,936 | 27.5% | ||
khan.dayyanz | 0 | 2,494,966,220 | 5% | ||
jacuzzi | 0 | 7,231,715,082 | 13.75% | ||
catalellazp | 0 | 648,251,142 | 27.5% | ||
mrmiyagi | 0 | 579,297,409 | 50% | ||
russia-btc | 0 | 345,013,465,027 | 100% | ||
bigmoneyman | 0 | 524,164,741 | 30% | ||
tinyhousecryptos | 0 | 469,182,698 | 5% | ||
shauner | 0 | 487,079,547 | 50% | ||
genesishealthy | 0 | 2,015,107,241 | 27.5% | ||
imbartley | 0 | 631,058,978 | 20% | ||
gurseerat | 0 | 5,355,767,206 | 20% | ||
elizabeths14 | 0 | 244,591,826,794 | 27.5% | ||
lrekt01 | 0 | 6,552,364,249 | 80% | ||
everythingsmgirl | 0 | 8,049,158,856 | 50% | ||
lisamgentile1961 | 0 | 8,465,288,894 | 3% | ||
sbi-tokens | 0 | 33,391,505,345 | 49.76% | ||
urun | 0 | 23,733,452,476 | 100% | ||
therealyme | 0 | 26,135,804,630 | 8.25% | ||
qwertm | 0 | 4,202,495,770 | 50% | ||
manclar | 0 | 9,512,763,535 | 50% | ||
neoxvoter | 0 | 3,030,289,373 | 25% | ||
treasure.hoard | 0 | 474,934,268,756 | 100% | ||
dpend.active | 0 | 3,792,310,337 | 10% | ||
honey-swap | 0 | 93,316,848,056,302 | 100% | ||
ykretz | 0 | 1,397,696,029 | 15% | ||
dimeshana | 0 | 979,511,225 | 5.5% | ||
sketching | 0 | 7,135,333,428 | 50% | ||
kiemis | 0 | 8,844,363,798 | 2.5% | ||
hivemexico | 0 | 1,023,912,644 | 55% | ||
woelfchen | 0 | 121,893,509,418 | 31% | ||
palimanali | 0 | 4,188,918,556 | 27.5% | ||
actioncats | 0 | 8,929,500,041 | 44% | ||
mtzrene | 0 | 490,906,368 | 85% | ||
dannewton | 0 | 627,959,308,623 | 100% | ||
archon-gov | 0 | 108,180,847,039 | 50% | ||
syberia | 0 | 1,439,753,929 | 27.5% | ||
rudy-dj | 0 | 2,671,467,081 | 30% | ||
friendlymoose | 0 | 628,618,818,968 | 50% | ||
museodelcaos | 0 | 1,443,193,338 | 25% | ||
gabrieljr | 0 | 726,606,322 | 25% | ||
brujulamusical | 0 | 701,541,762 | 13.75% | ||
lbi-token | 0 | 1,097,536,782 | 0.55% | ||
josuemonterola | 0 | 1,376,805,238 | 13.75% | ||
godfather.ftw | 0 | 3,238,871,235 | 5% | ||
youloseagain | 0 | 523,680,922 | 5% | ||
hivecreators | 0 | 30,837,112,386 | 55% | ||
esmeesmith | 0 | 2,525,566,886 | 50% | ||
eturnerx-dbuzz | 0 | 213,858,757 | 0.7% | ||
emsenn0 | 0 | 4,051,462,527 | 20% | ||
cryptoniusrex | 0 | 41,223,015,280 | 100% | ||
nodoninja | 0 | 2,083,376,502 | 55% | ||
encouragement | 0 | 19,587,394,675 | 55% | ||
gaboamc2393 | 0 | 6,815,552,118 | 22% | ||
keithtaylor | 0 | 2,758,878,825 | 21% | ||
ferbu | 0 | 3,788,891,558 | 27.5% | ||
aliento.love | 0 | 17,851,837,963 | 55% | ||
trashyomen | 0 | 543,013,940 | 75% | ||
subidu | 0 | 11,210,169,990 | 55% | ||
wongi | 0 | 69,284,476,221 | 50% | ||
onewolfe | 0 | 518,250,625 | 50% | ||
adulruna | 0 | 21,761,044,129 | 100% | ||
mirroredspork | 0 | 29,335,649,906 | 100% | ||
vrezyy | 0 | 8,938,882,219 | 25% | ||
tub3r0 | 0 | 767,218,428 | 10% | ||
mxm0unite | 0 | 1,615,148,239 | 50% | ||
dstampede | 0 | 1,780,489,403 | 100% | ||
ingi1976 | 0 | 3,292,450,941 | 25% | ||
tydynrain | 0 | 15,455,289,016 | 10% | ||
brofund-1up | 0 | 171,322,546 | 100% | ||
dkidfit | 0 | 5,524,636,720 | 100% | ||
svanbo | 0 | 1,815,089,103 | 1% | ||
herman-german | 0 | 9,722,996,646 | 50% | ||
lolz.oneup | 0 | 98,666,415 | 100% | ||
rulivyxo | 0 | 549,292,072 | 30% | ||
apoklipsix | 0 | 932,417,768 | 50% | ||
erochka | 0 | 1,097,581,508 | 27.5% | ||
liveofdalla | 0 | 22,195,460,019 | 27.5% | ||
marynn | 0 | 1,582,799,806 | 20% | ||
neruel | 0 | 17,042,494,268 | 13.75% | ||
karelnt | 0 | 453,218,117 | 13.75% | ||
chrisly.social | 0 | 61,493,344,595 | 50% | ||
ryosai | 0 | 5,988,548,365 | 24% | ||
cryptocubangirl | 0 | 756,268,409 | 27.5% | ||
noakmilo | 0 | 56,423,416,644 | 27.5% | ||
yennysferm71 | 0 | 12,640,825,013 | 55% | ||
beststart | 0 | 15,130,897,398 | 5% | ||
yisusth | 0 | 20,090,386,264 | 27.5% | ||
karlex77 | 0 | 24,387,725,782 | 16.5% | ||
ninaeatshere | 0 | 104,856,504,653 | 49% | ||
fonestreet | 0 | 3,274,429,438 | 25% | ||
rukien | 0 | 5,793,474,942 | 100% | ||
alejandroloreto | 0 | 1,060,469,017 | 27.5% | ||
holdeck2 | 0 | 1,529,440,135 | 100% | ||
vrezion | 0 | 567,316,408 | 100% | ||
casimodo | 0 | 890,714,541 | 100% | ||
magic.oneup | 0 | 0 | 100% | ||
poplar-22 | 0 | 3,473,019,125 | 25% | ||
mirian-liz | 0 | 676,606,485 | 13.75% | ||
monsterrerentals | 0 | 34,246,987,139 | 100% | ||
deggial | 0 | 758,672,093 | 100% | ||
theoneblog | 0 | 1,984,923,629 | 27.5% | ||
gornat | 0 | 41,371,074,476 | 100% | ||
kasih-sayang | 0 | 883,665,471 | 30% | ||
ammy11 | 0 | 1,273,245,757 | 20.62% | ||
sarybeth | 0 | 2,068,937,508 | 13.75% | ||
flywithmarlin | 0 | 2,129,928,574 | 27.5% | ||
ajolote | 0 | 12,305,245,811 | 55% | ||
whitneyalexx | 0 | 16,784,483,872 | 50% | ||
pof.archon | 0 | 469,133,410 | 50% | ||
freecompliments | 0 | 2,867,192,215,521 | 100% | ||
georgesantana73 | 0 | 1,058,257,769 | 100% | ||
tengolotodo.leo | 0 | 1,426,879,446 | 50% | ||
hive-140084 | 0 | 71,035,657,121 | 100% | ||
timix648 | 0 | 1,128,340,440 | 70% | ||
briefmarken | 0 | 45,333,066,909 | 100% | ||
converter.bonus | 0 | 853,195,996 | 50% | ||
pepetoken | 0 | 781,277,018 | 10% | ||
moisesjohan | 0 | 1,542,565,846 | 27.5% | ||
ijebest | 0 | 513,338,202 | 5% | ||
lordnasty | 0 | -23,841,787,837 | -100% | ||
bankrobbery | 0 | 625,896,803 | 50% | ||
fc-curation | 0 | 5,889,381,918 | 100% | ||
empo.voter | 0 | 83,487,339,625 | 1.1% | ||
fc-rewards | 0 | 3,756,499,643 | 100% | ||
d-a-d | 0 | 10,447,968,977 | 50% | ||
pepe.voter | 0 | 21,888,971,982 | 50% | ||
nayvethleyva | 0 | 763,157,516 | 55% | ||
samstreamer | 0 | 603,001,261 | 25% | ||
blessskateshop | 0 | 58,264,645,901 | 12% | ||
claudiavb | 0 | 17,942,869,205 | 50% | ||
fc-arbitration | 0 | 755,518,713 | 100% | ||
juliahiggs | 0 | 959,562,762 | 55% | ||
murtaza-7868 | 0 | 821,420,094 | 50% | ||
lolz.byte | 0 | 0 | 100% | ||
bbarelyseal | 0 | 0 | 100% | ||
partytime.inleo | 0 | 5,774,238,813 | 10% | ||
magicalex | 0 | 3,198,922,158 | 70% | ||
franco10 | 0 | 5,714,232,118 | 25% | ||
henrysw | 0 | 753,262,879 | 27.5% | ||
indeedly | 0 | 3,283,641,727 | 50% | ||
trovepower | 0 | 2,359,523,677 | 50% | ||
digi-alt | 0 | 3,596,029,626 | 50% | ||
michael561 | 0 | 5,475,542,864 | 20% | ||
thecrazygm.bank | 0 | 8,131,004,391 | 100% | ||
magic.byte | 0 | 0 | 100% | ||
sports.power.bot | 0 | 0 | 0.01% | ||
gerardosahagun | 0 | 659,299,394 | 27.5% |
Congratulations @thecrazygm! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s) <table><tr><td><img src="https://images.hive.blog/60x60/https://hivebuzz.me/badges/postallweek.png"></td><td>You have been a buzzy bee and published a post every day of the week.</td></tr> </table> <sub>_You can view your badges on [your board](https://hivebuzz.me/@thecrazygm) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub> <sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>
author | hivebuzz |
---|---|
permlink | notify-1753069311 |
category | hive-186392 |
json_metadata | {"image":["https://hivebuzz.me/notify.t6.png"]} |
created | 2025-07-21 03:41:51 |
last_update | 2025-07-21 03:41:51 |
depth | 1 |
children | 0 |
last_payout | 2025-07-28 03:41:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 607 |
author_reputation | 369,471,453,088,962 |
root_title | "Coming Soon: A Major Refactor of the Hive-Engine distribution-engine-smt, Maybe?" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 144,259,509 |
net_rshares | -8,709,346,908 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
thecrazygm | 0 | 79,216,647,348 | 100% | ||
themarkymark | 0 | -85,812,487,443 | -0.19% | ||
letusbuyhive | 0 | -2,113,506,813 | -0.04% |
You're a fricking badass, my friend! That's extraordinary! I can't imagine that the Hive Engine team wouldn't accept it, as it obviously improves the functionality of the code. 😁 🙏 💚 ✨ 🤙
author | tydynrain |
---|---|
permlink | re-thecrazygm-2025720t20947899z |
category | hive-186392 |
json_metadata | {"links":[],"type":"comment","tags":["hive-186392","dev","hiveengine","scot","smt","tribes","archon","pimp","proofofbrain","oneup","arcadecolony"],"app":"ecency/3.3.3-mobile","format":"markdown+html"} |
created | 2025-07-21 06:09:51 |
last_update | 2025-07-21 06:09:51 |
depth | 1 |
children | 0 |
last_payout | 2025-07-28 06:09:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.012 HBD |
curator_payout_value | 0.013 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 187 |
author_reputation | 209,979,605,186,825 |
root_title | "Coming Soon: A Major Refactor of the Hive-Engine distribution-engine-smt, Maybe?" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 144,261,142 |
net_rshares | 80,827,552,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
thecrazygm | 0 | 80,827,552,000 | 100% |