node 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
node 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
node 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 MIT License
操作系统 跨平台
软件类型 开源软件
所属分类 其他开源区块链
地区 不详
投 递 者 首席测试
适用人群 未知
收录时间 2021-11-30


The Node

CircleCI Renovate enabled semantic-release Docker Automated build Join the chat at

The Node allows you to timestamp documents in a decentralized manner.

It's built on top of the Bitcoin blockchain and IPFS.


How to Run the Node

To run the Node, clone this repo, and make sure you have Docker and docker-compose installed.

Clone the repo:

git clone
cd node

To start the Node environment, run:

docker-compose up --build

Using the instructions above, new blocks have to be generated manually. This is often desirable during development. To have blocks automatically generated, follow the instructions below instead to mine a new block every 5 seconds.

  $ cp docker-compose.override.yml.example docker-compose.override.yml
  # Edit docker-compose.override.yml and uncomment
  # the `regtest-watcher` service in `docker-compose.yml`
  $ docker-compose up --build

You only need to run docker-compose build to create or update the Docker images, and docker-compose up -d to start them. To shut everything down, it is recommended to use docker-compose down --volumes to stop the running containers and clear any data. If you wish to keep data between invocations, use docker-compose down.

You can also docker-compose exec mongo bash and docker-compose exec ipfs sh to run the mongo shell or ssh into the IPFS container.


The Node depends on RabbitMQ, IPFS, Bitcoin Core and MongoDB.

These dependencies are setup automatically when you run docker-compose.


The Node comes with a default configuration that works out of the box, which can be found here:

By default, anchoring to the blockchain is disabled (enableAnchoring: false). If you want to enable blockchain anchoring, you will need to the Bitcoin Core dependency to be running with a funded wallet so that it can pay the Bitcoin network transaction fees (either for testnet or real Bitcoin for mainnet).

You can change any configuration by passing configuration values via environment variables. The keys of these environment variables are always the SCREAMING_SNAKE_CASE equivalent of the configuration options listed in the default configuration. For example, the RabbitMQ URL (rabbitmqUrl) can be set with the RABBITMQ_URL environment variable.

Note: will NOT reload the configuration while it's running if you change it. You will need to restart the Node for configuration changes to apply.


Currently, the Node exposes four endpoints.

GET /works?issuer=xxx&limit=x&offset=x

Returns a paginated array of signed verifiable work claims.

Accepts the following query parameters:

  • issuer: string. If present, will only return works issued by this issuer.
  • limit: number. Maximum number of results to return per request. Defaults to 10.
  • offset: number. Number of claims to skip.

GET /works/:id

Returns a single signed verifiable work claim by its Id.

For simplicity, this endpoint adds a .anchor in the response, which is not a real part of the claim, but provides valuable information such as the ID of the transaction in which this claim has been anchored, the IPFS directory hash in which it can be found, etc.

A 404 error is returned if the claim isn't found in this Node's database. This doesn't strictly mean the claim does not exist in the Network — it just doesn't exist in this Node.

POST /works

Publish a signed verifiable work claim.

This endpoint is async and returns an ACK, unless an immediate error can be detected (e.g., a malformed claim). There is no guarantee that the work has actually been processed, sent to IPFS and anchored. To confirm that, you'll need to GET /works/:id and check the .anchor attribute.

This endpoint expects a fully constructed signed verifiable claim — with the correct '@context', .id, .issuer, .issuanceDate, .type, and sec:proof. See Building Claims for information on how to correctly create these attributes.

POST /files

Takes a multipart file upload. Currently only allows 1 file to be uploaded at a time and accepts 1 field which is the file to upload.

Returns an array with an object containing the hash and the archive URL of the file.


    hash: "QmS1s76raH43mLT3dSsMt7Nev1t9bM33GTFTZ9foXJV4ZT",
    archiveUrl: ""

Building Claims

A Claim is a signed verifiable claim that holds arbitrary information and allows the network to verify that the claim:

  • has actually been created by a specific person,
  • has not been modified since its creation, and
  • contains a special field type which will allow more features in the future.

For more information about claims and their structure, please see:

Verifying the Claim is on Bitcoin's Blockchain

Once node receives a claim, it stores the claim with some metadata including the following:

  • The highest block read at the time node stores the claim
  • Placeholders for the actual block that was mined including the claim

This allows the node application to track whether or not the claim actually has been successfully saved to the Bitcoin blockchain. There is a configuration value, maximumTransactionAgeInBlocks, that determines how far ahead the blockchain will grow before resubmitting the claim. Comparing this value against the delta between the highest block read and the block read at the time of claim creation will determine whether node resubmits the claim. JS

All the claim logic is abstracted away in JS, so if you are working with JavaScript or TypeScript you can simply use the library:

import { configureCreateVerifiableClaim, createIssuerFromPrivateKey, getVerifiableClaimSigner } from ''

const { configureSignVerifiableClaim } = getVerifiableClaimSigner()

const issuerPrivateKey = 'LWgo1jraJrCB2QT64UVgRemepsNopBF3eJaYMPYVTxpEoFx7sSzCb1QysHeJkH2fnGFgHirgVR35Hz5A1PpXuH6' 
const issuer = createIssuerFromPrivateKey(issuerPrivateKey)

const createVerifiableWorkClaim = configureCreateVerifiableClaim({ issuer })
const signVerifiableClaim = configureSignVerifiableClaim({ privateKey: issuerPrivateKey })

const workClaim = {
  name: 'The Raven',
  author: 'Edgar Allan Poe',
  tags: 'poem',
  dateCreated: '',
  datePublished: '1845-01-29T03:00:00.000Z',
  archiveUrl: '',
  hash: '<hash of content>',

const unsignedVerifiableClaim = await createVerifiableWorkClaim(workClaim)
const signedWorkClaim = await signVerifiableClaim(unsignedVerifiableClaim)

You can find more examples on how to build and publish claims in the integration tests in tests/API/integration/PostWork.test.



Run npm run build to compile the source. This will run TypeScript on the source files and place the output in dist/ts, and will then run Babel and place the output in dist/babel.

Currently, we're only using Babel to support absolute import paths.

During development, you can also run npm run watch to automatically watch for file changes, build the changed files and restart the application on the fly.


Unit and integration tests are located in this repo. You can run both with npm test or separately with npm run test:unit and npm run test:integration.

The integration tests run in isolated instances of the app and database.

Functional tests are run as follows:

  $ docker-compose build
  $ docker-compose up
  $ docker-compose exec poet-node npm run test:functional


Coverage is generated with Istanbul. A more complete report can be generated by running npm run coverage, which will run npm run coverage:unit and npm run coverage:integration together. You may also execute these commands separately.

Note: We are using our own forks of nyc and istanbul-lib-instrument in order to add better support for TypeScript. We intend to contribute our forks back to nyc and istanbul-lib-instrument in order to make our solution available to the entire community. You can follow the issues in this PR, and check the new PRs for istanbul-lib-instrument.




评论 (0)

2018/08/11 19:28


遍历各个pg_data_t节点。 1.定义在include/linux/nodemask.h中 /* * Bitmasks that are kept for all the nodes. */ enum node_states { N_POSSIBLE, /* The node could become online at some point */ N_ONLINE, /* The node is online */ N_NORMAL_MEMORY, /* The node has regular memory */ #ifdef CONFIG_HIGHMEM N_HIGH_MEMORY, /* The node has regular or high mem...

2020/01/19 19:50

The node before which the new node is to be inserted is not a child of this node.

今天上线打完包在线上跑,点击element的下拉筛选框突然卡死,控制台报上面的错误 ```js vendors~app.f874c403.js:58 DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node. ``` 经资料查询发现,导致上述异常是因为在html中使用了v-if来控制局部显隐导致的。 解释: 页面用了v-if去控制dom元素,之后js操作了v-if控制的dom元素而导致...

2012/07/12 12:48

什么是Node - 学习node

Node不是万能药!但的确能解决一些关键问题。 学习Node不是一件轻松事儿,但你所收到的回报是对得起你的付出的。 因为当下Web应用开发中的诸多难题唯有JavaScript才能解决。 目录 1. 专家们的警告! Node:几个小例子 Node不是JavaScript, Node可以运行JavaScript 和Node服务器的交互 5. 快速入门手册 6. 解释器之惑 基于事件的Web应用 Node的用武之地 “你够酷吗?来用我吧!” Node.js 为最新潮的编程语言提供了一系列很酷的A...

2020/09/01 19:27

Node 核心和 Node eventLoop

## Node 是什么 * Node.js 是一个开源与跨平台的 JavaScript 运行时环境; * Node.js 在浏览器外运行 V8 JavaScript 引擎(Google Chrome 的内核) * Node.js 应用程序运行于单个进程中,无需为每个请求创建新的线程 * Node.js 在其标准库中提供了一组异步的 I/O 原生功能(用以防止 JavaScript 代码被阻塞),并且 Node.js 中的库通常是使用非阻塞的范式编写的(从而使阻塞行为成为例外而不是规范) * Node.js 执行 I/O 操作时...

2019/02/20 20:44


node 文件路径 手动运行 nodemon 文件路径 自动运行 location.href=’要跳转的网页’ 跳转到 ‘其他网页’ 使用npm init -y 初始化包管理配置文件 (就是创建一个package.json) 运行 npm i express -S 安装node框架 module.exports 向外暴露私有成员 //创建服务器 const express = require('express'); const app = express(); __dirname 代表当前文件所在目录 //启动服务器 App.listen(端口号,()=>{}); //创建服务器 const expr...

2021/01/16 16:43


前言 该文章来自于chh大佬的投稿,为他打call 为何需要node调试? 熟练使用node调试能让你在日常开发中更快的定位问题所在的代码,提高开发效率 如何进行node调试? node调试方式多样,本篇只介绍笔者最熟悉的使用vscode的调试方式 使用vscode运行 vscode左侧共有五个按钮,第四个按钮即为"运行"按钮,假如你的根目录没有.vscode文件夹,点及"创建launch.json"文件后选择Node.js,创建成功后在文件夹目录下新增了一个.vscode文件...

2020/04/23 08:16


Node npm 包管理工具:可下载jquery/bootstrap/vue/webpack等 npm管理项目 npm init -y npm install xxx@0.0.0 npm uninstall xxx npm i 下载package.json所有的依赖 webpack打包工具 webpack有两种打包方式,生产模式和开发模式: 生产模式:wepack --mode production,打包慢 开发模式:wepack --mode development,打包快 默认的入口文件 手动创建的src/index.js 默认的出口文件 dist/main.js webpack --mode development/pr...

0 评论
0 收藏