Commercializing Steemnova Project with automated Dark Matter distribution

in utopian-io •  last year  (edited)

It is not online! It is only tool shared with all of you. All changes will be anounced by admins in official update. Follow @steemnova account for all important informations. - what it is all about

It's a piece of code that adds Dark Matter to the payer account.
For example I transfer 10 SBD to the @steemnova account with given memo (atm. 'ZGFya21hdHRlcgo') and in game resource called Dark Matter will be automatically added in no time!
No manual administrator action required!

Techical Description


Code is written in python3.6

The most needed dependency is steem_dshot for integration with Steem blockchain.

Rest of unusual dependencies are:

  • MySQLdb
  • csv

Code Explantaion

There are 6 funcions:

1- init() - it connects to the DB and interacts with Steem blockchain

 _database = MySQLdb.connect(host="localhost", user="unova", passwd="password", db="NOVADB") # creates global _database object variable 


        _json = s.get_account_history('steemnova', -1, limit=300)   # getting steem history for account steemnova from newest one with limit 300 so "grab last 300 actions from steemnova acc" and put it in global variable
except :
        raise NameError("init() failed at downloading history. \tData response:\n\t "+data) # if failed then inform system about it

2- get_transfers() - it is taking only STEEM/SBD transactions from all of the account activity (upvotes, flags, posted posts, comments) from global var. and loging it into file for future payments and archiving. This function also handles calculating amount of DM added into players account. It saves searched tx's into CSV file with given headers for easy data handling.


3- pay_users(String __user,int __amount,String __timestamp,DB_object _database)

var types only for visualization

This one does the main job. It technically handles the money.
It takes username, amount to pay, timestamp to log and database object at which it will make SQL query.

_cursor = _database.cursor()
__query = "UPDATE {0} SET darkmatter=(darkmatter+{1}) WHERE username='{2}'".format(_table_name, __amount, __user)

4- rotate() - I called it so in a surge of creative inspiration ッIt does act as brain for the whole thing. Almost...

rotate() opens txt file in which it have saved timestamp for last payed tx in format: YYYY-MM-DDTHH:mm:ss
and then pays everyone that have send TX after saved timestamp (info from *.csv file).
Magic two lines (if row[timestamp] is later than lastpaid timestamp):

if row['timestamp'] > __lastpaid_date:                      
                    pay_users(row['player'], row['darkmatter'], row['timestamp'], _database)

5- log(__line) - it takes given string __line and appends it to the log file which is our CSV file.

6- cleanup() - closes the DB connection

So that's all from technical point of view. Whole code is available at github (link below). Please comment suggestions after seeing "TO DO" paragraph.

To Do Essentials

  • [ ] init() - give it file handling capabilities - to check if logfiles are existing and make them as needed
  • [ ] get_transfers() - add SBD and STEEM recognition and also validate taken data to dodge nasty injections
  • [ ] in general - make some exception handling, make it userproof, add some asci arts :)


It has been tested and works just as it was supposed to work.

Author Comments

All suggestions will be happily accepted and positively considered but only construtive criticism will be taken in mind.

Feel free to ask, comment & play with us!


Posted on - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.


I'd like to be a member of utopian, but I am not ready to use my master key to login. Can't you implement a version of utopia without this requirement?

Thank you for approval! :)

Great! How about making it avaible in the game?

I see a very interesting oportunity here. Getting crypto from fiat is an unsolved problem. What if one could do that by playina Steemnova? There could be a market like there is one for selling metal, crystal or deuterium. But this one would sell Dark Matter, which would be paid in STEEM! And, the most interesting bit, the merchant could offer the player to pay with fiat (most certainly paypal). This would be profitable, and a real boost for the game. I am not a programmer, but am definitely keen on cryptos, python, blockchain. I have a background in business, so I could help in that side of things.

Hey @theravikin I am @utopian-io. I have just upvoted you!


  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • This is your first accepted contribution here in Utopian. Welcome!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!


Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord

  ·  last year (edited)

hey @theravikin

sry but to me this sounds like a terrible feature :(
pay2win sucks and destroyed ogame...It will destroy SteemNova as well !
in my optionen this fails totally and is only for paying "Noobs"...
this game should be fair!

i hope that criticism is constructive enough...


You can always have versions of the game with and without paying customers.

Another version that should be there is one that allows bots. A non paying universe, a paying universe, and a universe in which bots are allowed. Wouldn't that be awsome?

Leave it as a feature as post in #steemnova tag or at github issues page

Yeah, it is!

Stay calm, it is only tool which I made for admins if they want to sell DM to players.
IT IS NOT in the game.
There won't be silent update.
You will not be forced to play with "pay 2 win" players.

IF it will be added there will be second universe for this kind of gameplay.
If you want to pay you would have to register on uni with DM market. If not, there will be "pay free" universe like UNI1 for now.

So, you won't be farmed by rich steemians. :)

Thx for comment! I should have said that it isn't online now, and I will now.