SteemAX Update to v0.3 ~ New Features

Repository

https://github.com/artolabs/steemax

SteemAX v0.3

SteemAX is a web application that allows a Steemian to barter with other Steemians for an automatic exchange of upvotes for an agreed duration.

So far, SteemAX has been under rapid development and as of last update is capable of allowing a user to create an invitation, barter on that invitation, accept the invitation, and cancel the invitation. The invitation process is conducted mostly through a Steemian's wallet by sending any amount of SBD along with a specific command attached to the Memo ID. The auto-exchange algorithm is also completed and evaluates and verifies the posts, voting power and vote weight for each upvote exchange. SteemAX was, until now, entirely command-line driven.

steemax_update.jpg

Thank you!

I want to say thanks one more time to @beladro for creating the new SteemAX logo! There were an incredible amount of contributions submitted and it was truly hard choosing from them all.

I also want to thank those who have contributed so far to helping to redesign the SteemAX web page.

New Features

SteemAX now

  • has a live web interface. You can now see the live testing platform for SteemAX by visiting https://steemax.trade. A new module web.py was created to handle the web interface.

  • uses SimpleSteem for all interactions with the Steem blockchain and ScreenLogger for printing to screen and logging.

  • uses SteemConnect for account creation and authentication.


    login.gif

Steps taken to accomplish new features

1. I refactored and reformatted the code, then moved all Steem-Python functions into a single class named "steemutil.py".

Proof of work

2. I then refactored further to move this class in a new repository named SimpleSteem. I integrated the SteemConnect core functions into SimpleSteem.

Proof of work # 1

Proof of work # 2

3. I modified the the database module to add new users and to update user's SteemConnect tokens. A new user can now be added at the command prompt as well as logging in via the website using SteemConnect. I also removed the command prompt for accepting an invitation as that is now done solely by sending a command in an SBD send to @Steem-AX.

Add new user

Added to steemax.py



def new_account(self, acct):
'''Prompts user to create an account
when an account is not found
'''
answer = input(("{} has not joined SteemAX.\n"
+ "Would you like to add this "
+ "user [y/n]? ").format(acct))
if answer == "y":
self.key()
db.add_user(self.username, self.privatekey, 
self.refreshtoken, 
self.accesstoken)
return True
else:
return False

def do_adduser(self, args):
enter = Enter()
acct = enter.key()
db.add_user(acct, enter.privatekey, 
enter.refreshtoken, 
enter.accesstoken)



Added to axdb.py


if not self.get_results("SELECT * FROM users WHERE 1;"):
self.commit('CREATE TABLE IF NOT EXISTS users '
+ '(ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, '
+ 'Account varchar(50), PrivateKey varchar(100), '
+ 'RefreshToken varchar(400), Token varchar(400), '
+ 'Time TIMESTAMP DEFAULT CURRENT_TIMESTAMP);')
...

def get_user_token (self, acct):
if self.get_results("SELECT PrivateKey, Token, RefreshToken "
+ "FROM users WHERE Account = %s;",
acct):
return self.dbresults[0][1]
else:
return False



def update_token (self, acct, accesstoken, refreshtoken):
return self.commit("UPDATE users SET Token = %s, "
+ "RefreshToken = %s WHERE Account = %s;",
accesstoken, refreshtoken, acct)

def add_user (self, acct, key, refreshtoken, accesstoken):
return self.commit('INSERT INTO users (Account, PrivateKey, '
+ 'RefreshToken, Token) '
+ 'VALUES (%s, %s, %s, %s);',
acct, key, refreshtoken, accesstoken)


Verify user's SteemConnect Token

Added to steemax.py


def key(self):
''' Prompt user for their private 
posting key as found in their 
steemit.com wallet or for their
SteemConnect Refresh Token as 
given by the auth_url login
'''
msg.message(xverify.steem.connect.auth_url())
while True:
key = input('Your Private Posting Key or'
+ ' SteemConnect Refresh Token: ')
if len(key) < 16:
msg.error_message('The private posting key you '
+ 'entered is too small.')
elif xverify.steem.verify_key(acctname="", tokenkey=key):
self.privatekey = xverify.steem.privatekey
self.refreshtoken = xverify.steem.refreshtoken
self.accesstoken = xverify.steem.accesstoken
self.username = xverify.steem.username
msg.message("Welcome " + self.username)
break
else:
msg.error_message('Could not verify key or token.')
return self.username

Proof of work # 1

Poof of work # 2

Proof of work # 3

Proof of work # 4

4. I then added a new module named "web.py" that contains the methods used to call SteemConnect and verify the refresh token it delivers to the callback URL.

Proof of work

5. I then added the website files which use a very short and concise script to call SteemConnect via SteemAX and initiate the authentication process. All of the website files can be viewed here.

Proof of work

Technology Stack

SteemAX is written to use Python 3.5 and MySQL. The web interface for steemax.trade has been written in HTML and CSS and Javascript.

Roadmap

In the next phase of development I plan to add to the web.py methods that allow the user to create an invite. Accepting and canceling invites will be done solely by attaching a command to a Memo ID in a SBD send to @steem-ax, however I will be using the domain name https://steemax.info to create an additional web interface that allows a SteemAX user to generate the necessary Memo ID command that will be inserted into the memo of the SBD send. This will also be the page that a user can view all current exchanges and the status for each exchange. A user receiving an invite for the first time will be directed to create an account at steemax.trade, but all subsequent times the user may accept invites directly from their wallet.

Contact

Please contact Mike (Mike-A) on Discord
https://discord.gg/97GKVFC

GitHub Account

https://github.com/artolabs

Sort:  

Thanks for the contribution, @learnelectronic! It seems like a quite a lot of work went into this contribution, and although a lot was that was refactoring code, there are definitely still some improvements that could be made. I would definitely recommend getting a linter, as this would help prevent the same mistakes from happening

  • Too many blank lines - you inserted a lot of them when it's not needed
  • There's a lot of trailing whitespace in places
  • Don't add whitespace before '('
  • Continuation lines over-indented or under-indented a lot of the time
  • In axe.py there are loads of unused variables
  • In axtrans.py you use self a lot, but the instance of AXtrans does not have those members the majority of the time you use it

It is great that you kept everything below a width of 80 characters, though!

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @learnelectronics
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63815.31
ETH 3124.40
USDT 1.00
SBD 3.99