From 4ac5fdb6868be1abded933ae9c325fb0c9a0ea7b Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 28 Jun 2024 06:14:29 -0600 Subject: [PATCH] Update configuration.md - Editable RPC config advice for the upcoming release, https://github.com/streamr-dev/network/pull/2581 --- docs/docs/usage/configuration.md | 54 +++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/docs/docs/usage/configuration.md b/docs/docs/usage/configuration.md index 9160304a85..ae90179603 100644 --- a/docs/docs/usage/configuration.md +++ b/docs/docs/usage/configuration.md @@ -73,4 +73,56 @@ const streamr = new StreamrClient({ ... } } -``` \ No newline at end of file +``` + +## Blockchain RPC configuration +The Streamr Network continuously communicates with a blockchain selected by the user, with the Polygon POS blockchain being the default choice. To facilitate this communication, the Streamr Node and Streamr SDK are configured with public RPC endpoints. Although Streamr ensures robust redundancy, these third-party dependencies may experience downtime. Therefore, you might prefer to use your own RPC provider. + +Here’s how to set it up: + +In the case of updating your Streamr node, add this section to your Streamr node config file, +```json +{ + "client": { + ... + "contracts": { + "ethereumNetwork": { + "chainId": 137 + ... + }, + "rpcs": [ ... ] + } + ... +``` + +In the case of updating your Streamr app which uses the Streamr SDK, add this section to the Client constructor, + +```ts +const streamr = new StreamrClient({ +... + contracts: { + ethereumNetwork: { + chainId: 137 + ... + }, + rpcs: [ ... ] + } +... +}) +``` + +Where the `137` chainId refers to [Polygon POS](https://chainlist.org/). + +Example RPC section: +``` +rpcs: [{ + url: "https://polygon-rpc.com", + timeout: 120000 + }, + { + url: "https://polygon-bor.publicnode.com", + timeout: 120000 + }], +``` + +Note, this RPC config schema applies to Streamr node and SDK versions `100.2.5` and above.