@kyve/core
🚀 The base KYVE node implementation.
Integrations
Existing integrations
Creating a custom integration
Installation
yarn add @kyve/core
Using KYVE in your application
In order to use KYVE in your own integration you only need to extend the exported base class KYVE
.
Example EVM integration
import KYVE from "@kyve/core";
import { providers } from "ethers";
import { version } from "../package.json";
process.env.KYVE_RUNTIME = "@kyve/evm";
process.env.KYVE_VERSION = version;
KYVE.metrics.register.setDefaultLabels({
app: process.env.KYVE_RUNTIME,
});
class EVM extends KYVE {
public async getDataItem(key: number): Promise<{ key: number; value: any }> {
let provider;
let block;
try {
provider = new providers.StaticJsonRpcProvider(this.pool.config.rpc);
} catch (err) {
this.logger.warn(
`⚠️ EXTERNAL ERROR: Failed to connect with rpc: ${this.pool.config.rpc}. Retrying ...`
);
throw err;
}
try {
block = await provider?.getBlockWithTransactions(key)!;
block.transactions.forEach(
(transaction: Partial<providers.TransactionResponse>) =>
delete transaction.confirmations
);
} catch (err) {
this.logger.warn(
`⚠️ EXTERNAL ERROR: Failed to fetch data item from source at height ${key}. Retrying ...`
);
throw err;
}
return {
key,
value: block,
};
}
public async validate(
localBundle: any[],
localBytes: number,
uploadBundle: any[],
uploadBytes: number
): Promise<boolean> {
return super.validate(localBundle, localBytes, uploadBundle, uploadBytes);
}
}
new EVM().start();
Querying data
Coming soon!
Contributing
To contribute to this repository please follow these steps:
- Clone the repository
git clone git@github.com:KYVENetwork/core.git
- Install dependencies
yarn install