NAV
javascript shell

Tools for Easy Protocolization

pro·to·col /ˈprōdəˌkôl,ˈprōdəˌkäl/

noun

the official procedure or system of rules governing affairs of state or diplomatic occasions. "protocol forbids the prince from making any public statement in his defense"

Tokenized Protocols

Bitcoin and others have popularized the system of using tokens within a network of peers as a means of rewarding good behaviour. This addition has expanded the feasibility of protocols as tools for social change, and specifically has created a new type of economic motive which can be sharpened and honed specifically for a particular task.

Koi

The aim of the Koi network is to provide a convenient and simple way for software developers to easily concieve, implement, and deploy new mechanisms, while also enriching the public commons.

Koi provides a suite of software tools designed to: 1. Reward attention-based contributions, such as art and public data sets; 2. Reliably track and reward repeatable tasks; 3. Establish incentives and markets to reward profitable shifts in behaviour of (1) or (2).


Join the Network

The Koi Network is made up of devices running compatible protocol software. Install the "Koi Tools" to join.

const tools  = require('koi-tools')
const ktools = new tools()
const walletKeyLocation = "/path/to/your/wallet.json";

async () => {

    await ktools.loadWallet(walletKeyLocation)

    console.log('ktools', ktools)

}

$ npm i -g koi
$ koi init --key "/path/to/your/wallet.json"

Make sure to replace /path/to/your/wallet.json with the location of your wallet file.


Registering Content

Every 24 hours, the Koi Network votes to mint 1000 new tokens and awards them to the registered owners of the most popular content since the previous day.

# With shell, you can just pass the correct header with each request
koi register "GoKkAKHi-g2WsVtcKKYqhRgpxOHlgtPRDxkIHC6FIAY" 
let txId = 'GoKkAKHi-g2WsVtcKKYqhRgpxOHlgtPRDxkIHC6FIAY';

var result =  await ktools.registerData(txId);

console.log('transaction', result)

Make sure to replace GoKkAKHi-g2WsVtcKKYqhRgpxOHlgtPRDxkIHC6FIAY with the address of the content you want to register.

Gateways

Gateways can be added to the Koi network to include more content in the traffic rewards network. Contact us about grants to help you get set up to track traffic and reward creators!

Install Koi Middleware

The Koi middleware package provides easy traffic logging, and will soon be expanded to support proof of work headers.

npm i -g koi-logs
const Express = require('express');
// import { config } from 'dotenv';
const { koiLogMiddleware, koiLogsDailyTask, koiLogsHelper } = require('koi-logs');

// config();

var app = new Express ();

// add koi tasks
app.use(koiLogMiddleware);
app.get("/logs", koiLogsHelper);
koiLogsDailyTask() // start the daily log task

// start the server listener
app.listen(process.env.PORT || 3000, () => {
  log.info(`[app] started on http://localhost:${process.env.PORT || 3000}`);
});

Testing Tips

While most Koi nodes rely on bundlers to store consensus data on their behalf, you can also interact directly with the Koi smart contract using the Koi Tools library. In order to do that, you'll first want to visit the Arweave Faucet to get some free storage tokens, and then return back here once you have a standard wallet.json RSA file.