Hive

A platform that acts as a “beehive” of connecting information - where each individual adds connections and new information or other media. Each “Hive” exists of objects (Run/Jiggs) that contain information and have pointers to other objects. Those objects can contain weblinks. If different hives connect, it might become like an interactive book that always lets you go on routes that you might want to read more about next.

Download

The hive application can be forked, cloned or downloaded through github:

Hive on github

You can view the running application here:

Hive

Installation

Install the app locally

After you've cloned the project, run the following commands to get a local instance of the application:

Install dependencies and run:

yarn install

yarn start

Your default browser should open now and show 'http://localhost:3000'

Code

The hive app is based on the following stack:

We built the application on the basis of reactjs and created the template using the create-react-app. Using the run framework we were able to store and retrieve objects on the bitcoin blockchain using the so called 'Jigs'. In order to display the hives and its nodes, we used react-graph-vis.

run
run is a software development kit (SDK) and protocol enabling arbitrary code to run on Bitcoin. Developers can write applications with interactive objects, called jigs. Jigs allow you to build almost anything you can dream up: tokens, contracts, interfaces, elections, games, digital pets, and more — all run on Bitcoin. run supports full object-oriented programming and anonymous functions using JavaScript. run is secure and performant for real applications today.

For more information, please see run

The Hive app currently stores two object (as jigs) on the blockchain:

  • Hives
  • HiveNodes

Hives can be created to bundle multiple hive nodes.

Hive nodes contain the main data of the hive. They can get linked and together they build the actual hive.

To create a jig one has to extend from the Jig class. After creation of the jig, the tx gets sent and the jig will get included on the chain.

Jig inheritancee

We inherited Hive and HiveNode from the Jig Class and store it on the blockchain. No additional persistence needed.

Code that represents a Hive

                                    
                                    
Code that represents a HiveNode

                                    
                                    
Smiley face

At the start of the application one has to create a hive. A hive is described by a name, description, owner, category, satoshis and an image url. The run framework creates a transaction immediately once a user has added a hive (and has sufficient balance to do so). If the user navigates into the hive, he or a third party can create Nodes that get added to that hive. Thus a node contains the information of the parent Hive as well as an optional link to a different node. Using those links a whole (bee)hive can be created.

Hive

A hive is defined by the following attributes:

Attribute Description
name Title of the hive
description Description of the hive
owner Whoever created the hive
Category Category of the hive (Politics, Cryptocurrency, ...)
Satoshis The creater of the hive can spend a specific amount of satoshis, that will be distributed among all the contributors of the hive (e.g. the ones that create HiveNodes)
Image The url of the image that will be displayed in the Hive app

HiveNode

A HiveNode is defined by the following attributes:

Attribute Description
name Title of the hive-node
description Description of the hive-node
owner Whoever created the hive-node
Url The url that references to the article described in the hive-node.
Image The url of the image that will be displayed in the hive-node
Hive Origin The hive that the node belongs to
Previous node Optional parameter: if set, a link gets created between this node and the previous node, thus creating a hive-like structure.

Login

If a user isn't logged in, he will get some random key pairs, provided by the run framework. After login, he can then set those keypairs to his account. After re-login, he will use the same keypairs and is able to transfer funds into his account.

Smiley face

Use run without login (creates random keys, which is sufficient to read on the blockchain)


                                    
                                    

Use run with login (using existing private keys to connect to the blockchain)


                                    
                                    

The app defines a prefix ('HiveTest'), which later can used to query the blockchain.


Query the blockchain

Example of a jig transaction: 44b7891370481142b19bc3e67346ec836ee0311d61881f6d1e2f86873b7f6ab0

One can see the mentioned prefix ('HiveTest') in the OP_RETURN


OP_RETURN decoded:
run,,HiveTest,_i0sG$p}HiF

Get Hive jigs

The run-framework provides a functionality to get the jig object out of the chain using the load() method. In order to specify the jig, one needs its origin or current location (updated jigs). Furthermore run gives the user the ability, to get all the jigs created by the same owner of the keys. In the hive project we faced the issue, that we are unable to get all the Hives, since various contributors are creating jigs in the Hive environment.

Hive makes use of the BitDB Bitquery API. With the following query Hive is able to fetch all transactions that contain an OP_RETURN with the defined prefix ('HiveTest').

https://genesis.bitdb.network/q/1FnauZ9aUH2Bex6JzdcV4eNX7oLSSEbxtN/ewogICJ2IjogMywKICAicSI6IHsKICAgICJmaW5kIjogeyJvdXQuczIiOiAicnVuIiwgIm91dC5zNCI6IkhpdmVUZXN0In0sCiAgICAibGltaXQiOiAxMDAwCiAgfQp9

Known limitations

  • run framework: due to its alpha state, we found various issues with the framework. We got helped by their developers within the time of the hackathon but unfortunately there might be error messages when trying to create a tx.
  • The current state of the UI does not include any validations and proper error handling

Further improvements

In order to improve the application, the team already has the following ideas:

  • interactivity with other BSV applications (etched, moneybutton)
  • Filter the hives based on the category
  • bsv payments & tips to content creators
  • potentially tokenized tips to creators
  • pay each member of a selected list on each added link in the hive
  • comment function on the hive and its node