> For the complete documentation index, see [llms.txt](https://relationlabs.gitbook.io/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://relationlabs.gitbook.io/protocol/protocol-zh/quick-start/semantic-sbt.md).

# 基于Relation Protocol 部署合约

我们可以使用Relation 提供的[合约模版](https://github.com/relationlabs/semanticSBT/blob/main/contracts/template)，快速部署属于自己的Semantic SBT合约。

使用的部署工具为Hardhat，关于Hardhat的使用可参考：[使用Hardhat部署合约](/protocol/protocol-zh/appendix/deploy-a-contract-using-hardhat.md)

1. 下载合约

```shell
git clone git@github.com:relationlabs/semanticSBT.git
```

2. 安装依赖

```shell
cd semanticSBT
npm install
```

3. 修改配置文件

```shell
vi hardhat.config.js
```

注释以下内容(我们使用本地网络演示合约部署，不需要配置其他网络)

```solidity
rinkeby: {
  url: `https://rinkeby.infura.io/v3/${INFURA_PROJECT_ID}`,
  accounts: [`${PRIVATE_KEY}`]
}
```

4. 编译

```shell
npx hardhat node &
npx hardhat compile
```

5. 修改合约初始化参数

打开部署脚本

```shell
vi scripts/template/deployFollow.js
```

修改参数

```javascript
const name = "Bob's Connection Template";
const symbol = 'SBT';
const baseURI = 'https://api.example.com/v1/';
```

* name： 合约名称
* symbol： 合约symbol
* baseURI： 合约tokenURI的根目录

6. 执行部署脚本

```shell
npx hardhat run scripts/template/deployFollow.js
```

部署成功后，您将再控制台看到类似信息：

```shell
SemanticSBTLogic deployed ,contract address: 0x84323b27A2Ee0DecFe417695F5718BdeC23320E5
Follow deployed ,contract address: 0x89235270C230F8A9d16D49D18fC38cf9343B5F9A
Follow initialize successfully!
0xc1155B6aE7031fE0B9365Bec744aa8E8a298c78b following 0x7ed9cdb704052a9ba93e9df3f604436655680f86 successfully!
The rdf of the first token is: 
            :Soul_0xc1155b6ae7031fe0b9365bec744aa8e8a298c78b p:following :Soul_0x7ed9cdb704052a9ba93e9df3f604436655680f86.
```

其中，最后一句输出内容为一条RDF数据，表示了两个地址之间的following关系：

```
:Soul_0xc1155b6ae7031fe0b9365bec744aa8e8a298c78b p:following :Soul_0x7ed9cdb704052a9ba93e9df3f604436655680f86.
```
