Skip to main content

Streamr config

Whether you're developing an application in the browser, in NodeJS, or any other development environment, there will often be a need to configure the Streamr Node, or Streamr SDK to match your use case. Configuration changes are made through either the Streamr SDK constructor, or the Streamr config file.

The Streamr SDK constructor

For the full list of parameter options, see:

const streamr = new Streamr({
auth: {
privateKey: "ethereum-private-key",
},
// ... more configuration
})

The Streamr Node config file

The config file, typically located at .streamr/config/default.json or ~/.streamrDocker/config/default.json, as the name indicates, contains the configuration of the Streamr node. The main part of this config is the client section. The reamining configuration options of the Streamr node (Broker) config can be discovered from the broker config schema. For example, Node plugins are configured here.

The Streamr config package

Not to be confused with the internal Streamr package configurations such as the client and broker, the Network configuration contains mainly "Network level" parameters that are sometimes useful to read from, depending on your use case. The Streamr Network and Streamr apps reference an NPM package containing the Streamr config package. The config package helps resolve the network level configuration that contains contract addresses, entry point addresses, etc:

This package is regularly updated, for example when a new chain is supported, or a smart contract is upgraded.

import { config } from "@streamr/config"

const {
ethereum: {
id: chainId,
contracts: {
"DATA": dataTokenAddress
}
}
} = config

Chain configuration

The Streamr Network is an off-chain data network that can be combined with any EVM compatible blockchain. The Streamr "Mainnet" is coupled to the Polygon POS blockchain. Streamr has also deployed its infrastructure to the Polygon Amoy Testnet.

To be clear,

  • Streams are created on a chain (default chain is Polygon POS)
  • To subscribe to a stream, you must have the Streamr SDK or Streamr node configured to the chain that the stream is on.

Polygon Amoy Testnet

To switch chains, use the environment parameter. The default is polygon, which maps to the Polygon POS blockchain. To switch to the Polygon Amoy Testnet, follow these code snippets:

Streamr SDK:

const streamr = new StreamrClient({
auth: {
privateKey: PRIVATE
},
environment: "polygonAmoy",
})

Streamr node

{
"client": {
"auth": {
"privateKey": "PRIVATE"
},
"environment": “polygonAmoy”
},
"plugins": {
...
}
}