openbazaar-go:实践指南

作者:袖梨 2026-09-11

如果把openbazaar-go放进候选清单,不能只看热度;它的定位是OpenBazaar 2.0 Go 中的服务器守护进程。团队若要把它用于部署与运行环境,应先处理权限、依赖和环境差异会放大维护成本,否则试用结果很容易失真。先在非生产环境复现一次安装与运行更稳妥;过程中要观察依赖锁定、权限边界、日志、回滚和资源消耗,失败也应能解释原因。整体来看,它适合愿意维护环境并重视故障恢复的工程团队拿来做对照测试,最终决定仍应回到真实结果和维护状态。

开放市场

Go 中的 OpenBazaar 服务器守护进程

此存储库包含 OpenBazaar 服务器守护程序,用于处理 OpenBazaar 桌面应用程序的繁重工作。该服务器结合了多种技术:修改后的 IPFS 节点,它本身结合了 Git、BitTorrent 和 Kademlia 的想法。用于与多个加密货币网络交互的轻量级钱包。以及 JSON API,用户界面可以使用它来控制节点和浏览网络。在 github.com/OpenBazaar/openbazaar-desktop 中查找服务器的用户界面。

安装

OpenBazaar 的典型安装包含服务器守护程序和用户界面的捆绑包。如果这是您正在寻找的,您可以在 https://openbazaar.org/download. 找到安装程序。如果您希望单独运行服务器守护程序或为开发做出贡献,请参阅下面的说明。

安装预构建的软件包

运行服务器的最简单方法是下载预构建的二进制文件。您可以在此处找到针对每个操作系统 的最新版本的二进制文件。

从源代码构建

要从源代码构建,您需要安装并正确配置 Go。在每个操作系统上安装 Go 和 openbazaar-go 的详细说明可以在 文档包 中找到。

通过 Docker 镜像运行

您还可以使用我们的 Docker Hub 映像来运行 openbazaar-go。 latest 指向最新版本,但您可以通过将版本标签与 Docker 映像标签匹配来运行任何其他版本。

docker run -it openbazaar/server:latest [OPTIONS] start [start-OPTIONS]

依赖管理

我们将 Godeps 与供应的第三方软件包一起使用。

IPFS 依赖项

我们在守护进程中使用 go-ipfs 的 分支。主要变化包括使用不同的协议字符串将 OpenBazaar 网络与主 IPFS 网络隔离,以及在某些类型的 DHT 数据上增加 TTL。您可以在分叉存储库的自述文件中找到完整的差异。该分支捆绑在供应商包中,在编译和运行服务器时将自动使用。请注意,尽管该包是一个分支,但您仍然会看到 github.com/ipfs/go-ipfs 导入语句,而不是 github.com/OpenBazaar/go-ipfs。这样做是为了避免对 import 语句进行重大重构,并使 IPFS 变基变得更加容易。

更新中

您可以正常引入远程更改,也可以运行 go get -u github.com/OpenBazaar/openbazaar-go

用途

您可以使用 go run openbazaard.go start 运行服务器。确保您使用的 Golang 版本至少为 1.10,否则运行时可能会出现错误。

选项

Usage:
  openbazaard [OPTIONS] start [start-OPTIONS]

The start command starts the OpenBazaar-Server

Application Options:
  -v, --version                   Print the version number and exit

Help Options:
  -h, --help                      Show this help message

[start command options]
      -p, --password=             the encryption password if the database is encrypted
      -t, --testnet               use the test network
      -r, --regtest               run in regression test mode
      -l, --loglevel=             set the logging level [debug, info, notice, warning, error, critical] (default: debug)
      -f, --nologfiles            save logs on disk
      -a, --allowip=              only allow API connections from these IPs
      -s, --stun                  use stun on µTP IPv4
      -d, --datadir=              specify the data directory to be used
      -c, --authcookie=           turn on API authentication and use this specific cookie
      -u, --useragent=            add a custom user-agent field
      -v, --verbose               print openbazaar logs to stdout
          --torpassword=          Set the tor control password. This will override the tor password in the config.
          --tor                   Automatically configure the daemon to run as a Tor hidden service and use Tor exclusively. Requires
                                  Tor to be running.
          --dualstack             Automatically configure the daemon to run as a Tor hidden service IN ADDITION to using the clear
                                  internet. Requires Tor to be running. WARNING: this mode is not private
          --disablewallet         disable the wallet functionality of the node
          --disableexchangerates  disable the exchange rate service to prevent api queries
          --storage=              set the outgoing message storage option [self-hosted, dropbox] default=self-hosted
          --forcekeypurge         repair test for issue OpenBazaar/openbazaar-go#1593; use as instructed only

文档

OpenBazaar 协议的文档尚未正式化。如果您想提供帮助,请通过 Slack 或通过 GitHub 上的新问题联系。

openbazaar-go 公开了 HTTP API,它允许网络和内部钱包上的高级交互。在 https://api.docs.openbazaar.org 中查找 HTTP API 文档。

相关文章

精彩推荐