Ceramic: How to Host a Ceramic Node Using Decentralized Storage

Learn how to host a Ceramic Node Using Decentralized Storage.

What is Ceramic?

The Ceramic network is a decentralized network for building applications with composable data on Web3. Ceramic makes building apps as easy as browsing a marketplace of data models, selecting one to use in your app, then updating your app with your selected data model and its data. Since data on Ceramic is compostable, it can be reused across all applications, thanks to the Ceramic’s decentralized application databases.

Since Ceramic is a decentralized network, anyone can contribute to the network by providing storage space or network bandwidth through running their own Ceramic node. Ceramic nodes can be configured to use Filebase as the storage backend of a node.

Ceramic nodes can be used through NPM or through Docker containers. In this tutorial, we will showcase the use of Ceramic through NPM packages.

Learn how to host your own Ceramic node using Filebase by reading below.

Prerequisites:

This guide was tested and configured using Ubuntu 20.04. Commands and workflow may vary based on operating system.

1. Install the Ceramic IPFS-Daemon and set the Ceramic Network environment variable with the following commands:

npm install -g @ceramicnetwork/ipfs-daemon

npm install -g @ceramicnetwork/cli

export CERAMIC_NETWORK=testnet-clay

In this tutorial, we are using the testnet-clay network, since it is required that users configure and deploy their node on this network before requesting for it to be moved to the Ethereum mainnet network.

2. Then in a new shell window, configure Ceramic to use IPFS:

npm install -g @ceramicnetwork/cli

Ceramic nodes do not use IPFS for storage or pinning of files, they use IPFS for their peer-to-peer network connection to other nodes on the network.

3. Next, login to the Infura.io console. Create a new project.

4. Select the Ethereum network, and give your project a name.

5. In the Project settings, select "Ropsten” from the endpoint dropdown menu.

6. Then, take down the HTTPS Endpoint. You will need this in the next step.

7. Next, export your S3 configuration environment variables using the following commands:

export IPFS_S3_REPO_ENABLED="true"

export IPFS_PATH="/home/filebase/ceramic"

export AWS_ENDPOINT="https://s3.filebase.com"

export AWS_BUCKET_NAME="filebase-sample-bucket"

export AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXXX"

export AWS_SECRET_ACCESS_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

export AWS_REGION=”us-east-1”

export IPFS_BACKEND_ROOT="s3"

export IPFS_BACKEND_BLOCKS="s3"

export IPFS_BACKEND_KEYS="s3"

export IPFS_BACKEND_PINS="s3"

export IPFS_BACKEND_DATASTORE="s3"

Replace the following values:

  • AWS_ACCESS_KEY_ID: Filebase Access Key

  • AWS_SECRET_ACCESS_KEY: Filebase Secret Key

8. Then, it the daemon.config.js file in your $HOME.ceramic directory that has the following content:

{
  "anchor": {
    "ethereum-rpc-url": "https://infura_endpoint"  },
  "http-api": {
    "cors-allowed-origins": [".*"]
  },
  "ipfs": {
    "mode": "bundled”
  },
  "logger": {
    "log-level": 2, // 0 is most verbose
    "log-to-files": true
  },
  "network": {
    "name": "testnet-clay" // Connect to mainnet, testnet-clay, or dev-unstable
  },
  "node": {},
  "state-store": {
        "mode": "s3",
        "s3-bucket": "filebase-bucket-name"
    },
  }
}

Replace the following value:

  • "https://infura_endpoint": Replace with your Infura project HTTPS endpoint

9. Launch the Ceramic daemon:

ceramic daemon

You will receive output that resembles the following:

root@filebase:/home/filebase# ceramic daemon
Swarm listening on /ip4/127.0.0.1/tcp/4011/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
Swarm listening on /ip4/10.0.2.15/tcp/4011/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
Swarm listening on /ip4/172.20.0.1/tcp/4011/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
Swarm listening on /ip4/172.19.0.1/tcp/4011/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
Swarm listening on /ip4/127.0.0.1/tcp/4012/ws/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
Swarm listening on /ip4/10.0.2.15/tcp/4012/ws/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
Swarm listening on /ip4/172.20.0.1/tcp/4012/ws/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
Swarm listening on /ip4/172.19.0.1/tcp/4012/ws/p2p/QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP
IPFS API server listening on 5011
IPFS Gateway server listening on 9011
Starting Ceramic Daemon at version 1.11.1 with config:
{
  "anchor": {},
  "http-api": {
	"cors-allowed-origins": [
  	".*"
	]
  },
  "ipfs": {
	"mode": "bundled"
  },
  "logger": {
	"log-level": 2,
	"log-to-files": false
  },
  "network": {
	"name": "testnet-clay"
  },
  "node": {},
  "state-store": {
	"mode": "s3",
	"s3-bucket": "filebase-bucket"
  }
}
Connecting to ceramic network 'testnet-clay' using pubsub topic '/ceramic/testnet-clay'
Connecting to peers found in 'https://raw.githubusercontent.com/ceramicnetwork/peerlist/main/testnet-clay.json'
This node with peerId QmcKvFbyHu8H7PbycuyS6WWrz17JoLTuegMudUXXFRiHnP is not included in the peer list for Ceramic network testnet-clay. 
It will not be discoverable by other nodes in the network, and so data created against this node will not be available to the rest of the network.

The message at the end of this output indicates that the node is not discoverable by other nodes on the network since it is not listed on the Ceramic peer list.

To have your node added to the peer list for the Ceramic network testnet-clay, you need to submit a Pull Request for the Ceramic network’s Peerlist Github repo found here.

Once your node is added to the peer list, your Ceramic node will be live on the network!

Last updated