> For the complete documentation index, see [llms.txt](https://505876833.gitbook.io/gao-jin-yun-xin-xin-yong-chi-v1.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://505876833.gitbook.io/gao-jin-yun-xin-xin-yong-chi-v1.0/ping-tai-bu-shu/qu-kuai-lian.md).

# 区块链

在这里我们使用的Quorum提供的测试环境，它基于IBFT共识算法，包括4个验证者节点，3个普通成员节点和1个通用RPC节点。

### 环境需求

1. [Node.js](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04) （>14.0.0）

```
sudo apt update
sudo apt install nodejs
node -v
```

&#x20; 2\. [Docker 和 Docker-compose](https://docs.docker.com/compose/install/)

```
sudo apt-get update
sudo apt-get install docker.io
sudo apt-get install docker-compose-plugin
sudo apt-get update
```

&#x20; 3\. [Curl](https://curl.se/download.html)

```
sudo apt-get update
sudo apt install curl
```

### [部署命令](https://consensys.net/docs/goquorum/en/latest/tutorials/quorum-dev-quickstart/using-the-quickstart/)

```
npx quorum-dev-quickstart
```

<figure><img src="https://3649160502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAi4mF0F5vK1dOdGzysCZ%2Fuploads%2Fwd5NyrAbm5F9PDlesN3R%2Fquorum-dev-quickstart.gif?alt=media&amp;token=29068ec7-3861-487d-bc13-8695b2dd180e" alt=""><figcaption><p>Use Example</p></figcaption></figure>

{% hint style="info" %}
默认选择使用GoQuorum，其它根据需要来选择，一般情况下试用的模块都不添加
{% endhint %}

### 创世配置

打开区块链创世文件所在目录：/network/config/goquorum/

<pre><code>// 修改区块大小和合约大小限制
<strong>sudo vi qbftGensisi.json
</strong><strong>// 将maxCodeSize修改为如下：
</strong>"maxCodeSizeConfig": [
  {
    "block": 0,
    "size": 64
   }
],
// 区块链中执行交易都需要消耗gas，gasLimit即为区块大小，区块大小一定是大于合约大小的，所以修改了合约大小自然也应该修改区块大小
"gasLimit" : "0xE0000000",
</code></pre>

{% hint style="info" %}
Quorum本身就是在以太坊Geth客户端上的再包装，它的很多默认设置都与以太坊一致，比如合约最大为24kb。感兴趣也可以继续对合约进行优化，通过分离合约逻辑的方式减小它的体积。
{% endhint %}
