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

lukechampine.com/shard

Package Overview
Dependencies
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lukechampine.com/shard

Go Modules
Version
v0.3.9
Version published
Created
Source

shard

GoDoc Go Report Card

shard is a stripped-down Sia node that records host announcements and basically nothing else. When run as a public service, it provides these announcements to clients, sparing them the trouble of running a node themselves.

Host announcements are the mechanism by which Sia hosts associate their public key with their current IP address or domain name. Subsequent announcements for the same public key replace earlier ones. A shard server is thus analogous to a DNS resolver: it resolves public keys to network addresses.

While this is convenient, it also introduces a degree of trust. The amount of trust is (nearly) minimized, but still present. The host announcements reported by shard are signed by their public key, so shard cannot forge the announcements themselves. However, it can report outdated information. For example, a host might switch from address A to B, and make a new announcement declaring so; but a malicious shard server can continue providing the old announcement. shard also provides the current blockheight, and it can lie about that too. Fortunately, the consequences of these lies are minor, and the lies can be easily detected by comparing the responses of two or more servers.

The API for a shard server is as follows:

EndpointTypeDescription
/syncedJSON boolIf false, the server's responses may be outdated.
/heightJSON numberThe current height of the Sia blockchain.
/host/:pubkeyBinaryThe most recent announcement of the host with the request public key.

Announcements are encoded in binary using the Sia encoding format. An informal description of the announcement structure is as follows:

FieldSize (bytes)Description
Magic16The string "HostAnnouncement".
Address Len8The length of the subsequent address.
Address(variable)The host's network address, as a string.
Pubkey Type16The string "ed25519\0\0\0\0\0\0\0\0\0".
Pubkey Len8The length of the subsequent key; always 32.
Pubkey32The raw bytes of the ed25519 public key.
Signature64The ed25519 signature of the BLAKE-2B hash of the preceding bytes.

FAQs

Package last updated on 24 Sep 2021

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