@_koi/logs 中文文档教程

发布于 3年前 浏览 26 项目主页 更新于 3年前

注意:该项目正在进行中。 目前正在 Arweave 网关网络上进行测试,但此 repo 代表那里工作的当前状态以供参考。

Koi Logs SDK

Koi 是一个旨在奖励和帮助协调创建公共数据资源的网络。 安装 SDK 以将您的网关注册到网络,并在您提供日志记录数据时开始获得流量奖励。

Implementation

Koi 作为任何网关或软件库的一项功能进行安装,以可靠地跟踪流量并在被另一个节点审核时提供对其的访问。

Installation

通过添加如下所示的必要路由和中间件,可以为快速服务器实现 Koi 网关日志记录:

var app = new express();

app.get("/logs/", async function (req, res) {
  return await koiLogger.koiLogsHelper(req, res)
});
app.get("/logs/raw/", async function(req, res) { 
  return await koiLogger.koiRawLogsHelper(req, res)
});

app.use(koiLogger.logger);

app.get("/info/", async function (req, res) {
  return res.status(200).send("<html><i>Welcome to the fish pond.</i><html>");
})

现在,您网关上的任何流量都将自动进行混淆并提供给 koi 网络,您将获得一些锦鲤。

Permissions

请注意:您的 /tmp/ 目录必须对您的运行时用户可写,以确保可以正确写入日志。

Submitting Proofs

如果您正在构建一个将与 Koi 网关交互的工具,您可以提交两个标头以选择加入可验证的注意力监控。 这个过程被设计成匿名的,但通过用可以识别何时存在足够大的异常来表示可能被伪造的流量的 bellweather 数据证实原始流量来确保注意力跟踪的长期可行性。

可以通过向网关的所有请求附加两个额外的 HTTP 标头来提交证明: 锦鲤 => <代码>< id 元数据的 base 64 sha 256 哈希 + 时间戳 + 请求的资源,难度低于网络限制 > KOI_ID => <代码>< 任何有效的 arweave 地址 >

证明数据存储在标准日志文件中,并提供额外的安全和验证层。 反过来,社区的参与成员会收到与其作为领头羊的价值成比例的 Koi 代币。

Log Files & Clearing Cycle

每天,日志文件都会在 24 小时内更新,随后通过 /logs 端点发布供公众使用。

Example

检查运行 yarn test 以开始。

NOTE: This project is a work in progress. Currently testing is in progress on the Arweave Gateway Network, but this repo represents the current state of the work there for reference.

Koi Logs SDK

Koi is a network designed to reward and help to coordinate the creation of public data resources. Install the SDK to register your gateway to the network and begin receiving traffic awards when you contribute logging data.

Implementation

Koi is installed as a feature of any gateway or software library to track traffic reliably and provide access to it when audited by another node.

Installation

Koi gateway logging can be implemented for express servers by adding the necessary routes and middleware shown below:

var app = new express();

app.get("/logs/", async function (req, res) {
  return await koiLogger.koiLogsHelper(req, res)
});
app.get("/logs/raw/", async function(req, res) { 
  return await koiLogger.koiRawLogsHelper(req, res)
});

app.use(koiLogger.logger);

app.get("/info/", async function (req, res) {
  return res.status(200).send("<html><i>Welcome to the fish pond.</i><html>");
})

Now, any traffic on your gateway will automatically be obfuscated and provided to the koi network, and you'll earn some koi.

Permissions

Please note: your /tmp/ directory must be writeable to your runtime user to ensure that the logs can be written properly.

Submitting Proofs

If you are building a tool that will interact with Koi gateways, you can submit two headers to opt into verifiable attention monitoring. This process is designed to be pseudonymous, but ensures the long term viability of attention tracking by substantiating raw traffic volume with bellweather data which can identify when there is a sufficiently large abnormality to represent possibly falsified traffic.

Proofs can be submitted by attaching two additional HTTP headers to all requests to gateways: KOI => < base 64 sha 256 hash of id metadata + timestamp + requested resource, with difficulty below network limit > KOI_ID => < Any valid arweave address >

The proof data is stored in the standard log files, and provides an added layer of security and verification. Participating members of the community, in turn, receive Koi tokens proportionate to their value as a bellweather.

Log Files & Clearing Cycle

Each day, log files are updated over a 24 hour period, and subsequently released for public consumption via a /logs endpoint.

Example

Check run yarn test to start.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文