<commit_before>downstream-farmer
=================

Master: [![Build Status](https://travis-ci.org/Storj/downstream-farmer.svg?branch=master)](https://travis-ci.org/Storj/downstream-farmer)  [![Coverage Status](https://img.shields.io/coveralls/Storj/downstream-farmer.svg)](https://coveralls.io/r/Storj/downstream-farmer?branch=master)
Devel: [![Build Status](https://travis-ci.org/Storj/downstream-farmer.svg?branch=devel)](https://travis-ci.org/Storj/downstream-farmer) [![Coverage Status](https://img.shields.io/coveralls/Storj/downstream-farmer.svg)](https://coveralls.io/r/Storj/downstream-farmer?branch=devel)


## What is this I don't even?

`downstream-farmer` talks to [downstream-node](https://github.com/Storj/downstream-node).  In order to use it, you'll need a node up and running.  `downstream-node` requires MySQL and a working config, but *this app*, `downstream-farmer`, will require python-dev and libcrypto++-dev to install from source.

```
$ sudo apt-get install python-dev libcrypto++-dev
$ git clone -b devel https://github.com/Storj/downstream-farmer.git
$ cd downstream-farmer
$ pip install -r requirements.txt .
```

And connect to our test node by running:
```
$ downstream 'http://verify.driveshare.org:8000'
```

This prototype performs three simple functions.  It connects to the specified downstream-node, it requests a chunk (which also gives it the first chunk challenge), and then it answers the chunk challenge.

**If this is at all confusing, we're doing it as a functional test in the travis.yml file, so watch it in action on Travis-CI.**


## Client Functions
Connects to a downstream compatible node. Should also generate a new account token and retrieves the heartbeat for the proof of storage.

    connect(url)

Queries the server for a file chunk, which in this prototype is simply a file seed for RandomIO to generate.

    get_chunk()

Answers the chunk contract that was retrieved with get_chunk().

    answer_challenge()
<commit_msg>improved documentation<commit_after>downstream-farmer
=================

Master: [![Build Status](https://travis-ci.org/Storj/downstream-farmer.svg?branch=master)](https://travis-ci.org/Storj/downstream-farmer)  [![Coverage Status](https://img.shields.io/coveralls/Storj/downstream-farmer.svg)](https://coveralls.io/r/Storj/downstream-farmer?branch=master)
Devel: [![Build Status](https://travis-ci.org/Storj/downstream-farmer.svg?branch=devel)](https://travis-ci.org/Storj/downstream-farmer) [![Coverage Status](https://img.shields.io/coveralls/Storj/downstream-farmer.svg)](https://coveralls.io/r/Storj/downstream-farmer?branch=devel)


## What is this I don't even?

`downstream-farmer` talks to [downstream-node](https://github.com/Storj/downstream-node).  In order to use it, you'll need a node up and running.  `downstream-node` requires MySQL and a working config, but *this app*, `downstream-farmer`, will require python-dev and libcrypto++-dev to install from source.

```
$ sudo apt-get install python-dev libcrypto++-dev
$ git clone -b devel https://github.com/Storj/downstream-farmer.git
$ cd downstream-farmer
$ pip install -r requirements.txt .
```

And connect to our test node by running:
```
$ downstream
```

The usage is
```
usage: downstream-farmer [-h] [-V] [-n NUMBER] [-p PATH] [-s SIZE]
                         [-a ADDRESS] [-t TOKEN] [-f]
                         [node_url]

positional arguments:
  node_url              URL of the Downstream node

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -n NUMBER, --number NUMBER
                        Number of challenges to perform.If unspecified,
                        perform challenges until killed.
  -p PATH, --path PATH  Path to save/load state from.
  -s SIZE, --size SIZE  Total size of contracts to obtain.
  -a ADDRESS, --address ADDRESS
                        SJCX address
  -t TOKEN, --token TOKEN
                        Farming token
  -f, --forcenew        Force obtaining a new token
```

This prototype performs three simple functions.  It connects to the specified node, it requests a chunk (which also gives it the first chunk challenge and information to recreate the test file), and then it answers the chunk challenge.

**If this is at all confusing, we're doing it as a functional test in the travis.yml file, so watch it in action on Travis-CI.**


{'fraction_non_alphanumeric': 0.12542372881355932, 'fraction_numerical': 0.000903954802259887, 'mean_word_length': 3.654048370136698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '583645', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1317, 'n_words': 428}