Have a QNAP or Synology NAS with virtualization, docker and/or LXC, and want to use it for hosting premium content or some special purpose server? Maybe you have a chat server or a game server that you want to share with others, or maybe you have premium content you want to provide access to? Maybe you want your users to share in the cost for bandwidth, hardware and/or electricity for your services, or maybe you want to make a bit of money from premium content.
If any of these scenarios ring a bell, then this post might be for you. In this post I want to introduce the Steem Paywall Bot.
I have written a simple steem-python based steemit bot aimed at integrating a paywall for your service or premium content hosting with your steemit presence. If your service runs on a web server like nginx or apache or any other type of server that supports htpasswd files, than this bot can be your friend.
The steem-paywall bot is a little bot you run as a daemon on your home server. To run the bot, first install steem-python. Then run configure and run the script as described in the README.
The script will maintain a htpasswd for your site and allow for new htpasswd entries to be added to the file. You bind it to your steemit account so people can purchase their htpasswd entries using steemit SBD transactions. You may run multiple instances of the bot on different virtual machines to maintain different htpasswd protected services.
Please note that the paywall bot is meant to take one time payments for content or services. Entries don't expire or anything. You sell unlimited access to your service or premium content. You set the price and any steemit user can purchase access through the bot for that price.
In order to purchase access, the buyer will need to create an SBD transaction to your account with the price plus 0.001 SBD. The 0.001 extra is needed so that the paywall bot can return a status message transaction to the buyer. So for user convenience, it might be a good idea to for example charge 0.999 SBD or 1.999 SBD instead of 1.000 or 2.000.
A transaction message could look somthing like this:
- mypremiumcontent johndoe 3d5f8f9b6e5a5a5f55778a1b89caed2040e037b6
So here mypremiumcontent is the petname of your site or service. johndoe is the desired username and 3d5f8f9b6e5a5a5f55778a1b89caed2040e037b6 is the SHA1 of the desired password, in this case of the password Rumpelstiltskin1844Purple17Cake. As the hash will end up in the public steemit blockchain, it is important that the user chooses a sufficiently strong password.
So what happens now? The bot will parse the string. The bot will do its best not to be overzealous. Only if the expected format matches will it act as a paywall. Other transaction message formats will be treated as not an attempt to acquire access and will be treated as donation to your account. The bot will simply thank for the donation in a 0.001 SBD transaction.
If the format does match, the bot will try to return the money of the transaction if for some reason it is incapable of completing the transaction using the provided parameters. For example if the site petname is not the one configured, or if the user exists already in the htpasswd file.
If everything is OK, the bot will add a new entry to the htpasswd file, typically within two or three minutes after the transaction, and the user shall have access to your service or premium content using the supplied username and the strong password (s)he used to create the password hash.
Have fun using the Paywall Bot to provide steemit paid access to your services or premium content and remember me if this little bot ends up making you filthy stinking rich :-)