Skip to content

Commit

Permalink
fix: network generate with networkInfo (#105)
Browse files Browse the repository at this point in the history
* fix: network generate with networkInfo

* chore: upgrade bdk version

* feat: 2.1.1 readme and changelog
  • Loading branch information
kidneyweakx authored Feb 27, 2024
1 parent b0f47ac commit 00a7e17
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
這份文件將記錄 BDK 專案的變更日誌

All notable changes to BDK project will be documented here.
## [v2.1.1](https://github.com/cathayddt/bdk/releases/tag/v2.1.1) - 2024-02-27

### Fixes

* Network generate with networkInfo

## [v2.1.0](https://github.com/cathayddt/bdk/releases/tag/v2.1.0) - 2024-02-01

### Features
Expand Down
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
######## ######## ### ###
</pre>

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE) [![codeql-analysis](https://github.com/cathayddt/bdk/actions/workflows/codeql.yml/badge.svg)](https://github.com/cathayddt/bdk/actions/workflows/codeql.yml) [![test-report](https://github.com/cathayddt/bdk/actions/workflows/test-report.yml/badge.svg)](https://github.com/cathayddt/bdk/actions/workflows/test-report.yml) [![unit-test](https://github.com/cathayddt/bdk/actions/workflows/unit-test.yml/badge.svg)](https://github.com/cathayddt/bdk/actions/workflows/unit-test.yml)
[![NPM](https://img.shields.io/npm/v/%40cathaybc%2Fbdk?logo=npm)](https://www.npmjs.com/package/@cathaybc/bdk) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE) [![codeql-analysis](https://github.com/cathayddt/bdk/actions/workflows/codeql.yml/badge.svg)](https://github.com/cathayddt/bdk/actions/workflows/codeql.yml) [![test-report](https://github.com/cathayddt/bdk/actions/workflows/test-report.yml/badge.svg)](https://github.com/cathayddt/bdk/actions/workflows/test-report.yml) [![unit-test](https://github.com/cathayddt/bdk/actions/workflows/unit-test.yml/badge.svg)](https://github.com/cathayddt/bdk/actions/workflows/unit-test.yml)
</div>

提供指令快速建立、管理、監控 blockchain,最大的特色是可以使用互動式的問答,讓使用者可以依續性的問答來完成指令所需要的指令,在每個 BDK 指令的後面,加入 `-i` 或是 `--interactive` 的參數,來使用互動式問答
Expand All @@ -34,9 +34,9 @@ bdk fabric network create -i

| Latest | Stable |
| ---------------- | ---------------- |
| [v2.1.0][v2.1.0] | [v2.1.0][v2.1.0] |
| [v2.1.1][v2.1.1] | [v2.1.1][v2.1.1] |

[v2.1.0]: https://github.com/cathayddt/bdk/releases/tag/v2.1.0
[v2.1.1]: https://github.com/cathayddt/bdk/releases/tag/v2.1.1

[更新內容 (Changelog)](CHANGELOG.md)

Expand All @@ -52,7 +52,7 @@ bdk fabric network create -i

### 環境 (Prerequisites)

- [npm + nodejs](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) node v16, npm v8
- [npm + nodejs](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) node v18, npm v9
- [docker](https://docs.docker.com/engine/install)
- [docker-compose](https://docs.docker.com/compose/install) >= 1.27
- [docker-desktop(MacOS)](https://www.docker.com/products/docker-desktop/) Need Allow Docker Sockers in Advanced Options
Expand All @@ -63,12 +63,7 @@ bdk fabric network create -i
#### 直接安裝 (Direct Install)

```bash
npm config set @cathayddt:registry=https://npm.pkg.github.com

# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
npm config set //npm.pkg.github.com/:_authToken=[SET-YOUR-TOKEN]

npm install -g @cathayddt/bdk@latest
npm install -g @cathaybc/bdk@latest

# 初始化 (initialize)
bdk fabric config init
Expand Down
2 changes: 1 addition & 1 deletion docs/quorum/EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bdk hello
bdk quorum network create -i
```

依序輸入 `chain id`(預設為 81712)、`validator` 以及 `member` 的數量,並填入自己的錢包,如無錢包則選擇 `false`,會提供一組公私鑰來作為使用 Quorum 網路的帳號,該組帳號將在創始區塊擁有代幣
依序輸入 `chain id`(預設為 81712)、`validator` 以及 `member` 的數量,`Using bootnode?` 選項選 `false`並填入自己的錢包,如無錢包則選擇 `false`,會提供一組公私鑰來作為使用 Quorum 網路的帳號,該組帳號將在創始區塊擁有代幣

## 建立 Blockscout Explorer

Expand Down
Binary file modified docs/vhs/bdk-quorum-network-create.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/vhs/bdk-quorum-network-create.tape
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ Enter
Sleep 3s
Enter

Sleep 3s
Enter

# Admire the output for a bit.
Sleep 10s
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cathayddt/bdk",
"version": "2.1.0",
"version": "2.1.1",
"description": "Blockchain Deploy Kit",
"homepage": "https://github.com/cathayddt/bdk#readme",
"bugs": {
Expand Down Expand Up @@ -42,7 +42,7 @@
"test:fabric": "nyc npm run test -- --grep Fabric",
"test:coverage": "nyc npm run test",
"test:json": "NODE_ENV=testing BDK_PATH=$(pwd)/test/bdk BDK_DOCKER_HOST_PATH=$(pwd)/test/bdk mocha --reporter json --require ts-node/register ./test/**/*.test.ts --exit > test-results.json",
"git:changelog": "git-cliff --unreleased --tag v2.1.0 --prepend CHANGELOG.md",
"git:changelog": "git-cliff --unreleased --tag v2.1.1 --prepend CHANGELOG.md",
"doc:create": "npx typedoc --readme none --out ./api-docs --packages ."
},
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/quorum/service/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default class Network extends AbstractService {

public generate (networkGenerateConfig: NetworkGenerateType) {
const staticNodesJson: string[] = []

const networkInfo: NetworkInfoItem[] = []
// Add node to static-nodes.json
for (let i = 0; i < networkGenerateConfig.validatorNumber; i += 1) {
const { publicKey } = this.createKey(`artifacts/validator${i}`)
Expand All @@ -242,12 +242,15 @@ export default class Network extends AbstractService {
this.bdkFile.copyPrivateKeyToValidator(i)
this.bdkFile.copyPublicKeyToValidator(i)
this.bdkFile.copyAddressToValidator(i)
this.createNetworkInfoJson(networkInfo, `http://validator${i}:${8545 + i * 2}`)
}
for (let i = 0; i < networkGenerateConfig.memberNumber; i += 1) {
this.bdkFile.copyPrivateKeyToMember(i)
this.bdkFile.copyPublicKeyToMember(i)
this.bdkFile.copyAddressToMember(i)
this.createNetworkInfoJson(networkInfo, `http://member${i}:${8645 + i * 2}`)
}
this.bdkFile.createNetworkInfoJson(networkInfo)
}

public async addValidatorLocal () {
Expand Down

0 comments on commit 00a7e17

Please sign in to comment.