If you are not familiar with Swarm or Erebos yet, make sure to read the introduction blog post first!

Erebos v0.5: what’s new?

Feeds

Swarm feeds (previously called Mutable Resource Updates) provide a new API to read and write “mutable” data, by publishing updates in a predictable way.

As Swarm references are computed by hashing the content, publishing a new version of a static website, for example, produces a new hash. This means the modified website would have a completely different Swarm reference.

Until feeds came along, the solution to this problem was to use the Ethereum Name Service (ENS) to register a name such as theswarm.eth, and update this ENS entry to point to the new Swarm reference after uploading a new version of the website. This presents the drawback of needing to register an ENS domain in the first place, and then pay gas for each update.

With feeds, it is now possible to create a feed manifest, in order to retrieve a single hash, and then update this feed with new values pointing to the updated website contents — no ENS required!

The official Swarm documentation about feeds provides more detailed explanations about the advantage of feeds and how they work and for a simpler introduction, make sure to check Javier’s presentation. Javier Peletier is the CTO of Epic Labs and one of the top contributors to Swarm feeds. He notably uses them to implement the git protocol on top of Swarm in the ethergit project.

Erebos v0.5 adds supports for feeds as part of the BZZ APIs and provides new CLI commands to publish static websites, presented below.

// Example usage of the new BZZ APIs to update a feed // Upload new contents and retrieve feed metadata

const [dataHash, feedMeta] = await Promise.all([

this.client.bzz.uploadFrom('./dist'}),

this.client.bzz.getFeedMetadata(hash),

]) // Update the feed to point to the new contents hash

await this.client.bzz.postFeedValue(keyPair, `0x1b20${dataHash}`, {

topic: feedMeta.feed.topic,

})

Hexadecimal values encoding

Both Ethereum and Swarm APIs require values to be encoded as hexadecimal strings prefixed with 0x , which can sometimes be burdensome at the application level.

Erebos v0.5 introduces the new @erebos/hex package that provides utilities to convert strings, objects and buffers to and from hexadecimal-encoded values as needed by some of these APIs.

// Example usage of the added @erebos/hex package createHex('0x68656c6c6f').toString() // "hello"

createHex({ my: 'data' }).value // "0x7b226d79223a2264617461227d"

The Erebos BZZ and PSS APIs packages are now using this library, allowing some methods to provide more convenient interactions from the applications. This is a breaking change for the event emitted when receiving PSS messages.

New CLI commands

Beyond the existing BZZ commands, the CLI now supports additional Swarm APIs interactions.

PSS commands

PSS commands have been added to:

Display the given node’s base address and public key.

Convert a string to a 4-byte topic.

Listen to incoming messages on a given topic.

Send an asymmetrically encrypted message using a supplied peer public key and topic.

Create a bidirectional communication channel using a supplied peer public key and topic, to send and receive messages.

Website commands

As presented above, Swarm feeds support allow to provide a simple way for developers to publish static websites on Swarm without needing to use ENS.