From a8b60cfe5fd56e8131bc7f723a4dacf1bc0fdea5 Mon Sep 17 00:00:00 2001
From: furion <_@furion.me>
Date: Thu, 27 Apr 2017 23:48:35 +0200
Subject: [PATCH] update README

---
 README.md | 58 ++++++++++++++++++++++++++++++-------------------------
 1 file changed, 32 insertions(+), 26 deletions(-)

diff --git a/README.md b/README.md
index 723593dca..fd02660a5 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,7 @@
-## Dev Environment
+## Hivemind
+`hivemind` is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows.
+
+# Dev Environment
 
 Prepare MySQL Database (once):
 ```
@@ -11,38 +14,41 @@ make build
 make iypthon
 ```
 
-Apply MySQL Schema (from REPL):
+## Setting up MySQL
+First, we need to setup a MySQL server. An easy way to do that (in Docker) is to run:
 ```
-%run scripts/schema.py
+make mysql
 ```
 
-MySQL Schema (from code):  
-see `schema.setup()` and `schema.teardown()`
-
-*Todo: Implement migrations via Alembic.*
-
-## Hivemind
-`hivemind` is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows.
+Then we need to set `DATABASE_URL` environment variable, for example:
+```
+set DATABASE_URL 'mysql://root:root_password@mysql:3306/testdb'
+```
 
-It is primarily concerned with indexing specific `custom_json` namespaces but also watches for posts, votes, and account creations.
-
-[Community Spec Draft](https://github.com/steemit/condenser/wiki/Community-Spec-%5BDRAFT%5D)
+Lastly we invoke the `ensure-schema` command to create MySQL tables.
 
+```
+hive db ensure-schema --yes
+```
 
-Upon reindexing/following the blockchain, the following tables are populated:
+## Indexing the blockchain
+We can index the blockchain using cli as well. 
+```
+hive indexer from-steemd
+```
 
-### Core
+If we have a `.json.lst` file containing first X blocks, we can index from that (its much faster).
+```
+hive indexer from-file /path/to/blocks.json.lst
+```
 
- - `hive_blocks`: basic linked list of blocks to save current head block and ensure sequential processing
- - `hive_accounts`: basic account index. may be supplanted with cached data
- - `hive_posts`: main post index. contains core immutable metadata as well as community states
- - `hive_follows`: all follows and their creation date
- - `hive_reblogs`: all reblog actions (account, post, date)
- - `hive_posts_cache`: updated with latest state of posts as new blocks come in (removing need to query steemd)
+## Starting API Server
+```
+hive server dev-server --port 1234
+```
 
-### Community
+## Spec
+[Community Spec Draft](https://github.com/steemit/condenser/wiki/Community-Spec-%5BDRAFT%5D)
 
- - `hive_communities`: registered community data
- - `hive_members`: roles of accounts within each community, and metadata
- - `hive_flags`: track all community flag operations for mods to review
- - `hive_modlog`: tracks all `hivemind` related operations for auditability
\ No newline at end of file
+## License
+MIT
\ No newline at end of file
-- 
GitLab