跳到主要内容

搭建 Swarm 节点

要运行swarm,首先需要安装gethbzzd,这是swarm背景进程。

go get -d github.com/ethereum/go-ethereum
go install github.com/ethereum/go-ethereum/cmd/geth
go install github.com/ethereum/go-ethereum/cmd/swarm

然后我们将生成一个新的geth帐户。

$ geth account new

Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {970ef9790b54425bea2c02e25cab01e48cf92573}

将环境变量BZZKEY导出,并设定为我们刚刚生成的geth帐户地址。

export BZZKEY=970ef9790b54425bea2c02e25cab01e48cf92573

然后使用设定的帐户运行swarm,并作为我们的swarm帐户。 默认情况下,Swarm将在端口“8500”上运行。

$ swarm --bzzaccount $BZZKEY
Unlocking swarm account 0x970EF9790B54425BEA2C02e25cAb01E48CF92573 [1/3]
Passphrase:
WARN [06-12|13:11:41] Starting Swarm service

现在swarm进程已经可以运行了,那么我们会在下个章节学习如何上传文件。


完整代码

Commands

go get -d github.com/ethereum/go-ethereum
go install github.com/ethereum/go-ethereum/cmd/geth
go install github.com/ethereum/go-ethereum/cmd/swarm
geth account new
export BZZKEY=970ef9790b54425bea2c02e25cab01e48cf92573
swarm --bzzaccount $BZZKEY

title: 创建 Swarm存储 description: "这本迷你书的本意是给任何想用Go进行以太坊开发的同学一个概括的介绍。本意是如果你已经对以太坊和Go有一些熟悉,但是对于怎么把两者结合起来还有些无从下手,那这本书就是一个好的起点。" image: "https://ipfs.decert.me/QmfZm4ZahZBcpLNoMwNBX5kNLNaQ6PsPRV7oiJXTudvYWy" sidebar_label: "创建 Swarm存储"

概述: 搭建swarm节点的教程。

搭建 Swarm 节点

要运行swarm,首先需要安装gethbzzd,这是swarm背景进程。

go get -d github.com/ethereum/go-ethereum
go install github.com/ethereum/go-ethereum/cmd/geth
go install github.com/ethereum/go-ethereum/cmd/swarm

然后我们将生成一个新的geth帐户。

$ geth account new

Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {970ef9790b54425bea2c02e25cab01e48cf92573}

将环境变量BZZKEY导出,并设定为我们刚刚生成的geth帐户地址。

export BZZKEY=970ef9790b54425bea2c02e25cab01e48cf92573

然后使用设定的帐户运行swarm,并作为我们的swarm帐户。 默认情况下,Swarm将在端口“8500”上运行。

$ swarm --bzzaccount $BZZKEY
Unlocking swarm account 0x970EF9790B54425BEA2C02e25cAb01E48CF92573 [1/3]
Passphrase:
WARN [06-12|13:11:41] Starting Swarm service

现在swarm进程已经可以运行了,那么我们会在下个章节学习如何上传文件。


完整代码

Commands

go get -d github.com/ethereum/go-ethereum
go install github.com/ethereum/go-ethereum/cmd/geth
go install github.com/ethereum/go-ethereum/cmd/swarm
geth account new
export BZZKEY=970ef9790b54425bea2c02e25cab01e48cf92573
swarm --bzzaccount $BZZKEY