Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

go.sia.tech/hostd/v2

Package Overview
Dependencies
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

go.sia.tech/hostd/v2

Go Modules
Version
v2.9.0
Version published
Created
Source

Sia

GoDoc

A host for Sia.

Overview

hostd is an advanced Sia host solution created by the Sia Foundation, designed to enhance the experience for storage providers within the Sia network. Tailored for both individual and large-scale storage providers, hostd boasts a user-friendly interface and a robust API, empowering providers to efficiently manage their storage resources and revenue. hostd incorporates an embedded web-UI, simplifying deployment and enabling remote management capabilities, ensuring a smooth user experience across a diverse range of devices.

  • A project roadmap is available on GitHub
  • Setup guides are available at https://docs.sia.tech

Instant Syncing (Experimental)

New users can sync instantly using hostd --instant. When instant syncing, the hostd node initializes using a Utreexo-based checkpoint and can immediately validate blocks from that point forward without replaying the whole chain state. The state is extremely compact and committed in block headers, making this initialization both quick and secure.

Learn more

The wallet is required to only have v2 history to use instant syncing.

RHP4

RHP4 is the latest version of the renter–host protocol, delivering major performance improvements over RHP2 and RHP3. It supports significantly higher throughput and concurrency, enabling hosts to handle more renters in parallel with lower latency.

For maximum interoperability, RHP4 supports both:

  • SiaMux (TCP) — Secure, high-speed multiplexing layer, built by the Sia Foundation, allowing multiple protocol streams over a single connection. Reliable connections for most environments.
  • QUIC (UDP) — Modern, secure, multiplexed connections ideal for direct browser access. QUIC requires no special setup, but for better decentralization, configure a custom domain with a valid TLS certificate (certPath and keyPath in config).

Configuration

The YAML config file is the recommended way to configure hostd. hostd includes a command to interactively generate a config file: hostd config. Some settings can be overridden using CLI flags or environment variables.

Default Paths

Data Directory

The host's consensus database, host database, and log files are stored in the data directory.

Operating SystemPath
Windows%APPDATA%/hostd
macOS~/Library/Application Support/hostd
Linux/var/lib/hostd
Docker/data

Config File

Operating SystemPath
Windows%APPDATA%/hostd/hostd.yml
macOS~/Library/Application Support/hostd/hostd.yml
Linux/etc/hostd/hostd.yml
Docker/data/hostd.yml

The default config path can be changed using the HOSTD_CONFIG_FILE environment variable. For backwards compatibility with earlier versions, hostd will also check for hostd.yml in the current directory.

Default Ports

  • 9980/TCP - UI and API
  • 9981/TCP - Sia consensus
  • 9984/TCP - RHP4 (SiaMux)
  • 9984/UDP - RHP4 (QUIC)

When running in Docker, bind 9980 to 127.0.0.1 unless you explicitly intend to expose the API publicly.

Example Config File

directory: /var/lib/hostd
recoveryPhrase: indicate nature buzz route rude embody engage confirm aspect potato weapon bid
http:
  address: 127.0.0.1:9980
  password: sia is cool
syncer:
  address: :9981
  bootstrap: true
consensus:
  network: mainnet
  indexBatchSize: 1000
rhp4:
  listenAddresses:
    - protocol: tcp # tcp, tcp4 or tcp6
      address: :9984
    - protocol: quic # quic, quic4 or quic6
      address: :9984
  quic:
    certPath: '/path/certs/certchain.crt' # Certificate chain file (optional)
    keyPath: '/path/private/keyfile.key' # Certificate private keyfile (optional)
log:
  stdout:
    enabled: true # enable logging to stdout
    level: info # log level for console logger
    format: human # log format (human, json)
    enableANSI: true # enable ANSI color codes (disabled on Windows)
  file:
    enabled: true # enable logging to file
    level: info # log level for file logger
    path: /var/log/hostd/hostd.log # the path of the log file
    format: json # log format (human, json)

Configuration Reference

hostd loads defaults in code, then loads values from hostd.yml, and finally applies supported CLI flag overrides. A few settings can also be seeded from environment variables.

NameDescriptionDefault ValueCLI FlagEnvironment VariableYAML Path
NameFriendly display name for the host---name-name
DirectoryDirectory for host metadata, consensus data, and logsOS-specific data dir (%APPDATA%/hostd, ~/Library/Application Support/hostd, /var/lib/hostd, /data in Docker)--dirHOSTD_DATA_DIRdirectory
RecoveryPhraseWallet recovery phrase used to unlock the host wallet--HOSTD_WALLET_SEEDrecoveryPhrase
AutoOpenWebUIOpen the web UI in a browser on startuptrue--openui-autoOpenWebUI
HTTP.AddressAddress for serving the API and embedded web UI127.0.0.1:9980--http-http.address
HTTP.PasswordPassword for the admin API and web UI--HOSTD_API_PASSWORDhttp.password
Syncer.AddressAddress for peer-to-peer sync connections:9981--syncer.address-syncer.address
Syncer.BootstrapAdd built-in bootstrap peers for the selected networktrue--syncer.bootstrap-syncer.bootstrap
Syncer.EnableUPnPAttempt to forward the syncer TCP port via UPnPfalse--syncer.enableUPnP
Syncer.PeersAdditional peer addresses to add to the peer store at startup[]--syncer.peers[]
Consensus.NetworkConsensus network to joinmainnet--network-consensus.network
Consensus.IndexBatchSizeBatch size used by the index manager while processing updates1000--consensus.indexBatchSize
Consensus.PruneTargetNumber of recent blocks to retain when pruning consensus data. Should never be less than 144, unless disabled; 0 disables pruning0--consensus.pruneTarget
Explorer.DisableDisable the external explorer integrationfalse--explorer.disable
Explorer.URLExplorer API base URL used for explorer-backed featureshttps://api.siascan.com on mainnet, https://api.siascan.com/zen on zen--explorer.url
Storage.EnableMerkleCacheCache Merkle subtree roots in SQLite to reduce disk IO for partial readstrue--storage.enableMerkleCache
RHP4.QUIC.CertPathPath to the TLS certificate chain file for RHP4 QUICAuto-managed certificate if unset--rhp4.quic.certPath
RHP4.QUIC.KeyPathPath to the TLS private key file for RHP4 QUICAuto-managed certificate if unset--rhp4.quic.keyPath
RHP4.ListenAddresses.ProtocolProtocol for each RHP4 listener (tcp, tcp4, tcp6, quic, quic4, quic6)One TCP listener and one QUIC listener--rhp4.listenAddresses[].protocol
RHP4.ListenAddresses.AddressBind address for each RHP4 listener:9984 for both default listeners--rhp4 overrides the address for all configured RHP4 listeners-rhp4.listenAddresses[].address
Log.StdOut.EnabledEnable logging to standard outputtrue--log.stdout.enabled
Log.StdOut.LevelLog level for standard output logginginfo--log.level also sets this-log.stdout.level
Log.StdOut.FormatLog format for standard output (human or json)human--log.stdout.format
Log.StdOut.EnableANSIEnable ANSI color codes in standard output logstrue on non-Windows, false on Windows--log.stdout.enableANSI
Log.File.EnabledEnable logging to a filetrue--log.file.enabled
Log.File.LevelLog level for file logginginfo--log.level also sets this-log.file.level
Log.File.FormatLog format for file logging (human or json)json--log.file.format
Log.File.PathPath of the log file<data directory>/hostd.log when unset-HOSTD_LOG_FILE_PATHlog.file.path

Additional Environment Variables

  • HOSTD_CONFIG_FILE - overrides the path used to locate hostd.yml

Other CLI Flags

  • --env - disable stdin prompts for required values such as the API password and wallet seed
  • --instant - enable instant sync mode for faster initial sync

Building

hostd uses SQLite for its persistence. A gcc toolchain is required to build hostd

go generate ./...
CGO_ENABLED=1 go build -o bin/ -tags='netgo timetzdata' -trimpath -a -ldflags '-s -w'  ./cmd/hostd

Docker

hostd includes a Dockerfile which can be used for building and running hostd within a docker container. The image can also be pulled from ghcr.io/siafoundation/hostd:latest.

Be careful with port 9980 as Docker will expose it publicly by default. It is recommended to bind it to 127.0.0.1 to prevent unauthorized access.

Creating the container

1. Create the compose file

Create a new file named docker-compose.yml. You can use the following as a template. The /data mount is where consensus data is stored and is required. Change the /storage volume to the path of your storage drive. If you have additional mount points, add them.

services:
  host:
    image: ghcr.io/siafoundation/hostd:latest
    ports:
      - 127.0.0.1:9980:9980/tcp
      - 9981-9984:9981-9984/tcp
      - 9984:9984/udp
    volumes:
      - hostd-data:/data
      - /storage:/storage
    restart: unless-stopped

volumes:
  hostd-data:

2. Configure hostd

Run the following command to generate a config file for your host. Do not change the data directory from /data.

docker compose run -it host config

3. Start hostd

After creating a config file, it's time to start your host:

docker compose up -d

Building Image

docker build -t hostd .

FAQs

Package last updated on 03 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts