SteemAX Update: v0.2 Release
SteemAX is is an auto-upvote exchange
that allows Steemit users to exchange upvotes with each other for an agreed upon length of time. Please visit https://github.com/artolabs/steemax for more information and installation instructions using either
I've been incredibly busy updating and refactoring code so that SteemAX can be a stable and robust system capable of handling thousands of exchanges per hour. Primarily, I've been focused on finishing the authorization process, which will conclude when I have finished integrating SteemConnect.
Currently, the system still uses private posting keys for the authority to exchange upvotes, and it uses SBD transactions as a way of authenticating a user's account. In order for a SteemAX user to initiate an invite, or a barter, or to accept an invite, they must prove they are the owners of their account by sending any amount of SBD to SteemAX along with a memo message that contains an ID associated with that particular exchange. The SBD that is sent to SteemAX is forwarded to the other party of the exchange, unless the memo ID or it's associated action is invalid in which case the SBD is refunded. It's this system that is now completed at the command-line level. Below I have a complete flowchart and pictorial walk-through so that this process can be fully understood.
Here is a non-exhaustive list of updates that have been made in the last 16 days:
Practically the entire code base has been refactored into neatly organized classes instead of module definitions. The code is a thousand times cleaner, easier to read and runs faster. Hundreds of lines of redundant code was removed and made to be more pythonic.
A logging and error messaging system as implemented throughout all classes giving a plethora of new information about all SteemAX transactions and invites. This creates a log file named "error.log" and when logging is set at the "INFO" level all transaction activities are logged.
A new MySQL database was created to keep track of all authorization transactions. Each time SteemAX processes its transaction history, a record is made of the transaction including all relevant actions taken. This is used to prevent redundant transactions and keep track of the last transaction that was processed so that new transactions can be identified.
The authentication process was made more robust, and a number of bugs were removed. Steemax can now be run on my home laptop and perform almost all of its primary functions. Now that's efficiency!
Doc strings have been created and comments have been embellished so that they are more informative to those reading the source code. This will be an ongoing process so that as much confusion as possible is dispelled from the inner workings of SteemAX.
Two new modules were created to handle SteemAX transactions (axtrans.py) and messages printed to screen as well as to the logging file (axmsg.py).
All transactions are now handled using the steempy cli wallet and the installation instructions have been updated to provide details for configuring the steempy with SteemAX.
The new command
processhas been added to the command-line interface. Typing this command will cause SteemAX to run axtrans.py and process all new transactions containing memo IDs.
Exchange Invite and Authentication Process
Currently the invite process is command-line driven and requires both parties to be present at the same terminal. However, you can imagine, during this pictorial walk-through, each instance a command is entered via the command line will be replaced by a proper GUI running on a public server accessible anywhere.
To start the invite process a user must submit their Steemit account name, which generates a report like this.
Then the invitee's Steemit account name is entered.
Then, once both accounts are verified as existing accounts, the inviter is asked to enter their private posting key (soon to be SteemConnect authorization), along with the percentage of their upvote they would like to exchange, the ratio between their upvote and the invitee's upvote, and the duration in days that the exchange should occur. SteemAX then generates a Memo ID and appends the
start command to it.
The inviter then sends any amount of SBD to SteemAX along with the generated Memo ID and
process command at the SteemAX command prompt processes all new transactions that contain a Memo ID and responds accordingly. This command will eventually be run by crontab at a time interval suitable to the amount of traffic SteemAX incurs. In the future the blockchain will be streamed and transactions will be responded to in real time.
Then the invitee receives the invite. When the SteemAX GUI is fully implemented the invite will contain a link to a web-page that will allow the invitee to grant SteemAX permission to upvote by way of their private posting key, or soon, their SteemConnect token.
Currently the invitee accepts at the command line by entering the command
accept then their private posting key. SteemAX then shows the invitee the Memo ID with the
accept command appended.
To authenticate their account and initiate the exchange the invitee then sends any amount of SBD to SteemAX along with the Memo ID and
accept command as shown previously.
process command is run again to process new transactions.
The inviter receives a message that the exchange has been accepted.
At any point after both the inviter and invitee have submitted their private posting keys (or soon, SteemConnect tokens) and a Memo ID has been generated, a barter offer may be sent. Creating a barter offer pauses the exchange until it is accepted.
The SteemAX user enters the
barter command at the SteemAX command-line prompt to start the barter process. They then enter the Memo ID associated with that particular exchange. SteemAX calculates the new upvote exchange values and gives a report along with the Memo ID, and appended to it the
barter command, the percentage, the ratio, and the duration, in that order.
In the future SteemAX will present a list of current exchanges that a user is engaged in. When this is implemented a user will be able to start a barter simply by returning to the SteemAX GUI and clicking the "barter" link on the appropriate exchange. The user will not need to know the Memo ID at this point as it will be contained within the link. Mockups for this part of the SteemAX GUI will be made and submitted with the next update.
The user making the barter offer then sends any amount of SBD to SteemAX along with the Memo ID and
barter command. If the user is already adept to using SteemAX and knows the Memo ID already, they can skip using the GUI and start a barter just by sending this transaction.
Once again the
process command is run and SteemAX forwards the SBD along with the offer.
To accept a barter a user simply sends the Memo ID back along with the
accept command just as described earlier. Or they may generate their own barter offer and send that back instead.
Canceling an Exchange
To cancel an exchange a user simply needs to send the Memo ID with the
cancel command appended and the exchange will be canceled and the other party will be notified. An exchange can be canceled at any point in the process, including immediately after an invite has been sent, as a sort-of "undo" function.
The database will be converted to a true relational database by creating a separate table to contain user keys/tokens, and thus remove the repetition of keys in the database that can be caused by a user as they create more exchanges. This will also have the added benefit of alleviating the need for a user to enter their private posting key/SteemConnect authorization each time they wish to create a new exchange. However, users will always have to visit the SteemAX GUI and pass the captcha check in order to create an invite.
The memo messages that are parsed by SteemAX need to be filtered and sanitized for security.
Memo messages that are sent by SteemAX to users need to be cleaned up, given better formatting and provide clearer information.
SteemConnect will be utilized in the authorization process and a system for creating and storing SteemConnect tokens will be created.
Mockups for the SteemAX GUI that display a list of a users current exchanges and pertinent information will be created.
Tasks need to be created soon to have a SteemAX logo made along with a web page design guide and color guide so that the logo and web page design are matching.
There is currently a problem with the way a poorly matched ratio between accounts is recalculated. In other words, when a user enters a ratio that is not possible between two accounts (say a whale tries to match 100% of their vote with a minnow at a 1:1 ratio), the ratio entered will be rejected, and SteemAX will suggest a new ratio. The user will then have an opportunity to enter new values. The rejection process works fine, however that new ratio suggested sorely lacks in accuracy. This is not really a programming problem as it is a math problem, as I currently do not know how to calculate this new suggestion. If possible, I'd like to create a Utopian task to solve this math problem, however I'm not sure that would be acceptable, so if anyone reading this would like to pose a suggestion in the comments below it would be helpful.