# 🚀 Nockchain 节点安装与挖矿全流程指南（Ubuntu+MAC 版）

By [pangdong](https://paragraph.com/@pangdong) · 2025-05-13

---

![Introducing Nockchain](https://storage.googleapis.com/papyrus_images/4311345dd8d93202782b7eb6d6eb4d7f6ea98a5b5bae3e8b894b1e49c2fd6efd.jpg)

Introducing Nockchain

> 本文旨在帮助您在 Ubuntu 系统上快速部署 Nockchain 节点，生成钱包并开始挖矿。适合对区块链技术感兴趣的开发者和爱好者。

* * *

🧩 项目简介：什么是 Nockchain？
----------------------

Nockchain 是一个基于零知识证明（ZK）的轻量级区块链，采用 Rust 语言开发，旨在提供高效、可验证的计算平台。其核心特点包括：

*   **轻量级设计**：无需复制整个链的数据，降低存储和计算成本。
    
*   **可扩展性**：通过链下证明和链上验证的设计，支持大规模应用场景。
    
*   **安全性**：采用 Rust 语言开发，确保系统的安全性和稳定性。
    
*   **易用性**：提供详细的构建和运行指南，方便开发者快速上手。
    

更多信息请访问 [nockchain.org](https://www.nockchain.org/)。

建议的挖矿规格为：至少 64GB 的 RAM、200GB 的可用磁盘空间和快速的 CPU

* * *

![](https://storage.googleapis.com/papyrus_images/8a98ba470af111a1ab82c7d2322e962d8599ae3c4bd0cf5aec68d6d1fd2025a7.png)

![](https://storage.googleapis.com/papyrus_images/8a9d8e09e1e6741565f0a9eedce50ae6a69112572bd10d191d40859f4b580a78.png)

![](https://storage.googleapis.com/papyrus_images/9a89cbcf08f01f2fa0e94092a270ae6637a25095d216eb276179094bc984df26.png)

🛠️ 安装与配置步骤
-----------

### 1\. 更新系统并安装依赖

    sudo apt update && sudo apt install -y \
      screen curl iptables build-essential git wget lz4 jq make gcc nano \
      automake autoconf tmux htop nvme-cli libgbm1 pkg-config libssl-dev \
      libleveldb-dev tar clang bsdmainutils ncdu unzip
    

### 2\. 安装 Rust 环境

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
    source "$HOME/.cargo/env"
    rustup default stable
    

### 3\. 克隆 Nockchain 仓库

    git clone https://github.com/zorp-corp/nockchain
    
    cd nockchain
    

### 4\. 复制示例环境文件并将其重命名为`.env`：

    cp .env_example .env
    

### 6\. 编译项目

    make install-hoonc
    export PATH="$HOME/.cargo/bin:$PATH"
    
    make build
    
    make install-nockchain-wallet
    export PATH="$HOME/.cargo/bin:$PATH"
    
    make install-nockchain
    export PATH="$HOME/.cargo/bin:$PATH"
    

> ⚠️ 编译过程可能需要较长时间，请耐心等待。

### 7\. 配置环境变量

    source ~/.bashrc
    

* * *

🔐 生成钱包并提取公钥
------------

    nockchain-wallet keygen 
    

钱包生成后把全部内容备份最好

[https://swps.io/wallet](https://etherscan.io/address/swps.io) 安装你的钱包并导入私钥（现在钱包和windwos挖矿还没有推出）

![](https://storage.googleapis.com/papyrus_images/82f8342194301fad933450af4174a024507f29902995209b9d125b7cfaa13c35.png)

将公钥写入 .env：

     nano .env
    

查看公钥是否写入 .env：(输出的公钥应为你的公钥

    grep MINING_PUBKEY .env
    

* * *

🧠 启动节点
-------

### 启运这个挖矿

    screen -S nockchain
    
    bash ./scripts/run_nockchain_miner.sh
    

> 使用 `Ctrl+A` 然后按 `D` 可以退出 `screen` 会话而不关闭程序。

* * *

🍎 Mac 上安装和运行 Nockchain 的指南
---------------------------

### 1\. 安装依赖项

打开终端，执行以下命令：

    # 安装 Homebrew（如果尚未安装）
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    # 使用 Homebrew 安装 Git、Rust、screen
    brew install git
    brew install rustup
    brew install screen
    
    # 初始化 Rust 环境
    rustup-init
    source $HOME/.cargo/env
    

### 2\. 克隆官方仓库

    git clone https://github.com/zorp-corp/nockchain.git
    cd nockchain
    

### 3\. 安装 Hoon 编译器（choo）

    make install-hoonc
    
    export PATH="$HOME/.cargo/bin:$PATH"
    

### 4\. 构建项目

    make build
    

此命令将构建 Nockchain 节点、钱包和相关工具。

### 5\. 安装钱包

    make install-nockchain-wallet
    
    export PATH="$HOME/.cargo/bin:$PATH"
    

### 6\. 安装主链核心模块

    make install-nockchain
    
    export PATH="$HOME/.cargo/bin:$PATH"
    

### 生成新密钥对（钱包地址）

    nockchain-wallet keygen
    

输出内容包含：

*   `Public Key`
    
*   `Public Key`: 公钥地址
    
*   `Private Key`: 私钥，请务必妥善保存
    

* * *

### 🔑 从助记词生成主私钥（可用于恢复钱包）

    nockchain-wallet gen-master-privkey --seedphrase "your seed phrase here"
    

然后导出公钥：

    nockchain-wallet gen-master-pubkey --master-privkey <private-key>
    

执行下面命令把.env里面的公钥替换成你的公钥

    cp .env_example .env
    
    
    
    nano .env
    

* * *

### 7\. 运行挖矿

*   screen -S nockchain bash ./scripts/run\_nockchain\_miner.sh
    

*   查看 挖矿收益：
    
        nockchain-wallet --nockchain-socket ./test-leader/nockchain.sock update-balance
        
    

🔗 参考资料

*   官方网站：[nockchain.org](https://www.nockchain.org/)
    
*   GitHub 仓库：[github.com/zorp-corp/nockchain](https://github.com/zorp-corp/nockchain)
    
*   社区教程：[CSDN 博客](https://blog.csdn.net/gitblog_00079/article/details/147872489)
    

* * *

如需进一步的帮助或有任何疑问，欢迎加入 Nockchain 社区进行交流。祝您挖矿愉快！

* * *

---

*Originally published on [pangdong](https://paragraph.com/@pangdong/nockchain-ubuntu-mac)*
