Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kyve/core

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kyve/core

<code>@kyve/core</code> <p align="cen

  • 0.0.0-alpha.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
2
Weekly downloads
 
Created
Source

@kyve/core

A protocol for verified data streams.

Usage

Installation

yarn add @kyve/core

Creating a custom integration

Initiating a node
import KYVE from "@kyve/core";

const node = new KYVE();
Node configuration

KYVE requires two custom functions. One which fetches the data from your data source and one which validates this data. You can then simply add these two functions into the KYVE instance later on.

Specifying an upload function

To pass data into KYVE, simply call uploader.next():

const myDataUploader = async (uploader: UploadFunctionSubscriber, config: any) => {
  // use your custom logic here
  const data = ...
  uploader.next({ data });
}

You can also optionally add custom tags to your transactions:

const myDataUploader = async (uploader: UploadFunctionSubscriber, config: any) => {
  // use your custom logic here
  const data = ...
  const tags = [...]
  uploader.next({ data, tags });
}

The config value can be set in the DAO for the pool You can find the list of pools here

Specifying a validation function

The listener will automatically return new and unvalidated transactions from the uploader, which you can pass into your logic.

const myDataValidator = async (listener: ListenFunctionObservable,
                               validator: ValidateFunctionSubscriber,
                               config: any) => {

  listener.subscribe(async (ret: ListenFunctionReturn) => {
        // validate the data with your custom logic
        const isValid = ...
        // pass the result into KYVE
        validator.next({ valid: isValid, id: ret.id });
    });
}
Passing the functions into the node.
import KYVE from "@kyve/logic";

const node = new KYVE(myDataFetcher, myDataValidator);
Pool configuration

Next you need to set up the pool in the DAO. You can create a new pool here. After you have created the pool, insert its ID, the amount of $KYVE you want to stake for this pool and your arweave keyfile into the node config:

import KYVE from "@kyve/core";

const pool = 1;
const stake = 100
const jwk = ...

const node = new KYVE(myDataFetcher, myDataValidator, { pool, stake, jwk });
Running your node

To run your node, simply call the .run() function:

(async () => {
  await node.run();
})();

FAQs

Package last updated on 05 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc