Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thrize committed Jan 7, 2017
0 parents commit d67c03e
Show file tree
Hide file tree
Showing 6 changed files with 290 additions and 0 deletions.
34 changes: 34 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CC0 1.0 Universal

The code in this repository is CC0 unless covered by a different license as clearly stated. It is free to use for any purpose with or without attribution.

# Legal Code
from [https://creativecommons.org/publicdomain/zero/1.0/legalcode](https://creativecommons.org/publicdomain/zero/1.0/legalcode)

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.

For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:

the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
moral rights retained by the original author(s) and/or performer(s);
publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
rights protecting the extraction, dissemination, use and reuse of data in a Work;
database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.

4. Limitations and Disclaimers.

No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# FOSSbot

FOSSbot, or Free Open Source bot, is a curation bot for Steemit.com, which is an innovating social media platform based on the Steem cryptocurrency. You can check out the blockchain source at [https://github.com/steemit/steem](https://github.com/steemit/steem).

**Warning!**

A lot of this readme is aspirational and not yet implemented!

## Bots on Steemit

Bots, while controversial, have become a fact of Steemit usage. They maximise the rewards of users by voting strategically. They do game the system, but since the system is a game (and one of the co-creators is extremely ambivalent on the subject) it is tolerated.

However it's a concern that good bots are currently only the hands of a few users. While this is their purview, it's ours to use whatever we can within the system to compete with them. They do not really want much high quality bot competition, as it lowers their potential take, but if we don't level the playing field they will dominate the platform too much.

The goal of this project is to bring a high quality and fully customisable bot to anyone who is willing to put in the time to set up a server and write their own customisations. I'd like to see bot programming guilds of people helping each other

### What are you talking about?

Rewards? Strategic voting? Guilds? WHALES? What does it meeeeaan?

This bot is intended for users who already know their way around Steemit.com. If this is gibberish to you, please join and have a look for yourself. In other words, the difficulty here is intermediate.

## How it works

_Note, none of this is implemented yet, it's still in the ideation stage_

See my [original Steemit post here](https://steemit.com/curation/@personz/5qnnnx-free-open-source-steemit-bot-proposal-and-question) where this idea was proposed.

I'd like to propose these are curation goals a bot may maximise, cultural curation and strategic curation, which are interrelated. In my case, I'd like to the cultural aspect to take precedence, and restrict strategic voting somewhat. But I'd like any bot I create to be customisable enough that this is not built in, but rather that these aspects are recognised, and most importantly, measurable.

In order to make a choice on whether or not to vote on a post, we have to have some measurable metric to judge it against. I define strategic metrics to be any aspect which effect payout directly, through the voting algorithm. I define cultural metrics to be those that effect payout indirectly, by attracting voters based on content.

Most strategic metrics are simply readable from the API. But cultural metrics are harder to quantify, and I'd suggest Natural Language Processing (NLP) for this. There are some great libraries available for this.

Here are my suggested metrics:

### Strategic metrics

#### About the post

1. Time since post
2. Estimated payout
3. Number of votes
4. Number of flags / downvotes
5. The Steem Calculator already solves this, but it seems to be closed source (maybe @burnin would like to comment?)

#### About this user
1. Number of posts today
2. Time since last post (posts are rate limited [2])

### Cultural metrics

#### Content
Using NLP

1. Topic
2. Keywords
3. Sentiment / emotional score
4. Length
5. Number of video links
6. Number of photo links
7. Number of webpage links

#### Poster
Make judgements on whether or not the poster is someone you want to support

1. Reputation
2. Capital (either by value or by category, whale, dolphin, minnow)
3. Last post payout
4. Average / median post payout

Additionally you could have always vote or always don't note (white / black listing) for authors manually.

## Installation

_This is a proposal for installation procedure and not yet implemented_

1. Create a Heroku account
2. Deploy this project to the Heroku using the (yet to be added) Heroku Button below
3. Verify the project was set up on Heroku
4. Add a "Config variable" in the Heroku app settings for EMAIL_ADDRESS, adding your email address
5. Deploy the server (this is the terminology to start the server)
6. You will receive an email with a set up key, which can only be used within 5 minutes of it being issued
7. Open the app HTTPS dashboard and click the "Configure" button. Just open the root URL of your app hosted on Heroku, e.g. https://fossbot.herokuapp.com
8. Enter in your set up key
9. An API key will be generated for you. This API key is the only key usable to make a change to the server. Write it down as it cannot be reissued. The API key will only be valid as long as the server stays up, so you'll need to regenerate the API key using this same method

Now you can access your bots settings using the app HTTPS dashboard. You'll be asked for your API key every time you make a change so my recommendation is to use a password manager.

## Usage

The first thing you should do it set you Steemit posting key and test the API. All of this is available through the dashboard.

The operations you can perform are
- Set Steemit posting key
- Edit curation algorithm (hopefully)
- Run algorithm test
- Check bot status and stats
- Modify bot status (i.e. start / stop)

## License and acknowledgements

All original programming is under the CC0 license and so it completely open and free to use in any capacity. It's in the spirit of the project that it is open to all.

The [steem Node.js package](https://www.npmjs.com/package/steem), used to access the Steem API, is available on NPM, and the [source is on GitHub](https://github.com/adcpm/steem).
6 changes: 6 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "FOSSbot",
"description": "A general purpose curation bot built for the Steemit social media platform",
"repository": "https://github.com/evm2p/fossbot",
"keywords": ["node", "foss", "server", "steemit", "curation", "voting"]
}
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "FOSSbot",
"version": "0.0.1",
"description": "A general purpose curation bot built for the Steemit social media platform",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"repository": {
"type": "git",
"url": "https://github.com/evm2p/fossbot"
},
"keywords": [
"node", "foss", "server", "steemit", "curation", "voting"
],
"author": "evm2p",
"license": "CC0",
"bugs": {
"url": "https://github.com/evm2p/fossbot"
},
"homepage": "https://github.com/evm2p/fossbot",
"dependencies": {
"body-parser": "^1.13.3",
"express": "^4.13.3",
"steem": "0.3.31"
}
}
24 changes: 24 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en" ng-app="markpage-server">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style>
body {
padding-top: 50px;
}
</style>
</head>

<body>
<div class="container">
<h1>FOSSbot</h1>
</div>
<div class="container">
<p>A curation bot for <a href="http://steemit.com">Steemit</a></p>
</div>
<div class="container">
<p>Source code available at <a href="https://github.com/evm2p/fossbot">FOSSbot on GitHub</a></p>
</div>
</body>
</html>
93 changes: 93 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
'use strict';

const
express = require("express"),
path = require("path"),
bodyParser = require("body-parser"),
steem = require("steem");

var app = express();
app.set('port', process.env.PORT || 5000);
app.use(express.static(__dirname + "/public"));
app.use(bodyParser.json());

var fatalError = false;
var serverState = "stopped";

/*
* Tests
*/

/*
testEnvVars():
* Test environment variables and log results
*/
function testEnvVars() {
if (showFatalError()) {
return;
}
console.log("email address: "+process.env.EMAIL_ADDRESS);
console.log("private posting key?: "+(process.env.POSTING_KEY_PRV ? "true" : "false"));
console.log("api key?: "+(process.env.API_KEY ? "true" : "false"));
console.log("steem user: "+process.env.STEEM_USER);
if (!process.env.STEEM_USER) {
setError("init_error", true, "No STEEM_USER env var set, minimum env vars requirements not met");
}
}

/*
initSteem():
* Initialize steem, test API connection and get minimal required data
*/
function initSteem() {
if (showFatalError()) {
return;
}
if (process.env.STEEM_USER) {
steem.api.getAccounts([process.env.STEEM_USER], function(err, result) {
//console.log(err, result);
if(err || result.length < 1) {
setError("init_error", true, "Could not fetch STEEM_USER"+(err ? ": "+err.message : ""));
}

});
}
}

/*
* Utils
*/

/*
setError(status, isFatal, message):
* Set general error for server
*/
function setError(status, isFatal, message) {
serverState = status;
fatalError = !fatalError && isFatal;
console.log("setError to \""+serverState+"\" "+(isFatal ? "(FATAL) " : "")+(message ? ", "+message : ""));
}

/*
showFatalError()
* Show message for fatal error check.
* return: true if fatal error
*/
function showFatalError() {
if (fatalError) {
console.log("cannot process initSteem function, fatal error has already occured. Please fix and restart server");
}
return fatalError;
}

// Start server
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
testEnvVars();
testSteem();
if (!fatalError) {
console.log("Bot initialized successfully");
}
});

module.exports = app;

0 comments on commit d67c03e

Please sign in to comment.