### Configure and run ceramic-one daemon Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Shows various ways to start and configure the ceramic-one daemon with different options including help display, log level configuration, network selection, and custom storage directory. The daemon must be running before client connections can be established. ```bash # if necessary, include the path/to/the/binary e.g. /usr/local/bin/ceramic-one or ./target/release/ceramic-one $ ceramic-one daemon # There are many flags for the daemon CLI that can be passed directly or set as environment variables. # See `DaemonOpts` in one/src/lib.rs for the complete list or pass the -h flag $ ceramic-one daemon -h # A few common options are overriding the log level: $ RUST_LOG=warn,ceramic_one=info,ceramic_service=debug ceramic-one daemon # Or modifying the network $ ceramic-one daemon --network testnet-clay $ ceramic-one daemon --network local --local-network-id 0 # Or changing where directory where all data is stored. This folder SHOULD be backed up in production # and if you change the defaults, you MUST specify it every time you start the daemon. $ ceramic-one daemon --store-dir ./custom-store-dir ``` -------------------------------- ### Install Ceramic SDK client packages Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Installs the necessary Ceramic SDK packages for client development. Includes HTTP client for daemon communication, events package for creating/signing events, and identifiers package for stream/event type definitions. Requires Node.js and npm to be installed. ```bash npm install --save @ceramic-sdk/events @ceramic-sdk/identifiers @ceramic-sdk/http-client ``` -------------------------------- ### Build ceramic-one from source on Linux Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Compiles ceramic-one from source on Linux systems. Installs Rust compiler, build dependencies, Protocol Buffers compiler, clones the repository, and builds the binary. Requires sudo privileges for system-wide installation. ```bash # Install rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install build tools apt-get install -y build-essential pkg-config openssl libssl-dev unzip # Update environment source "$HOME/.cargo/env" # Install protobuf PROTOC_VERSION=3.20.1 PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip curl --retry 3 --retry-max-time 90 -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP \ && unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \ && unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \ && rm -f $PROTOC_ZIP # Checkout rust-ceramic repo git clone https://github.com/ceramicnetwork/rust-ceramic # Enter repo and build cd rust-ceramic make build cp ./target/release/ceramic-one /usr/local/bin/ceramic-one ``` -------------------------------- ### Install ceramic-one on Debian-based Linux Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Downloads and installs the latest ceramic-one release for Debian-based Linux distributions using dpkg package manager. Downloads a tar.gz file containing the Debian package, extracts it, then installs using dpkg. ```bash # get deb.tar.gz curl -LO https://github.com/ceramicnetwork/rust-ceramic/releases/download/latest/ceramic-one_x86_64-unknown-linux-gnu.tar.gz # untar the Debian software package file tar zxvf ceramic-one_x86_64-unknown-linux-gnu.tar.gz # install with dpkg - package manager for Debian dpkg -i ceramic-one.deb ``` -------------------------------- ### Setup ceramic-one with Docker-Compose Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Configures and runs ceramic-one using Docker-Compose for easier management. Creates a persistent data volume for daemon data, uses host networking, and runs the service in detached mode. Requires Docker and Docker-Compose to be installed. ```bash mkdir ceramic-recon cd ceramic-recon ``` ```yaml version: '3.8' services: ceramic-one: image: public.ecr.aws/r5b3e0r5/3box/ceramic-one:latest network_mode: "host" volumes: - ceramic-one-data:/root/.ceramic-one volumes: ceramic-one-data: driver: local ``` -------------------------------- ### Install ceramic-one daemon on macOS Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Installs the ceramic-one daemon on macOS using Homebrew package manager. Requires Homebrew to be pre-installed on the system. This provides the core daemon needed to interact with the Ceramic network. ```bash brew install ceramicnetwork/tap/ceramic-one ``` -------------------------------- ### PostgreSQL Database Setup for Ceramic Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Commands to create and configure a PostgreSQL database for Ceramic Network. This setup is required for production configurations on Mainnet. ```SQL CREATE DATABASE ceramic; CREATE ROLE ceramic WITH PASSWORD 'password' LOGIN; GRANT ALL PRIVILEGES ON DATABASE "ceramic" to ceramic; ``` -------------------------------- ### Install and Run Ceramic CLI Daemon Source: https://developers.ceramic.network/docs/protocol/js-ceramic/nodes/running-a-node Installs the Ceramic CLI from NPM and starts the daemon. This command is used to set up initial files and get a node running on the Clay TestNet. Ensure 'ceramic-one' binary is running in the background. ```bash npx @ceramicnetwork/cli daemon ``` -------------------------------- ### Initialize Ceramic client connection Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Sets up a Ceramic client instance to communicate with a running ceramic-one daemon. The client connects to localhost:5101 by default and can be used to make API calls to the Ceramic network. The getVersion() call verifies the connection and returns daemon version information. ```javascript import { CeramicClient } from "@ceramic-sdk/http-client"; const client = new CeramicClient({ url: "http://localhost:5101" }); // Now some calls! const response = await client.getVersion(); // Confirm it matches the version you just installed console.log(response.version); ``` -------------------------------- ### Install Ceramic HTTP Client Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/javascript-clients/ceramic-http This command installs the Ceramic HTTP client library using npm. It's the first step to integrating Ceramic into your project. ```bash npm install @ceramicnetwork/http-client ``` -------------------------------- ### Install did-session Module Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/authentication/did-session Installs the 'did-session' package using npm. This is the initial step before using the module in your project. ```bash npm install did-session ``` -------------------------------- ### Install Ceramic CLI with pnpm Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Command to install the Ceramic CLI globally using pnpm. The CLI provides commands to manage Ceramic nodes. ```Shell pnpm install -g @ceramicnetwork/cli ``` -------------------------------- ### Install Ceramic CLI with npm Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Command to install the Ceramic CLI globally using npm. The CLI provides commands to manage Ceramic nodes. ```Shell npm install --location=global @ceramicnetwork/cli ``` -------------------------------- ### Start GraphQL Server for ComposeDB Source: https://developers.ceramic.network/docs/composedb/interact-with-data Command to start a local GraphQL server for interacting with ComposeDB data. Requires a private key for authentication and allows port customization. ```bash composedb graphql:server --ceramic-url=http://localhost:7007 --graphiql runtime-composite.json --did-private-key=your-private-key --port=5005 ``` -------------------------------- ### Start Ceramic Local Node on Testnet-Clay Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Command to launch a local Ceramic node instance connected to the testnet-clay network. This is a confirmation step after configuration. ```bash ceramic daemon --network=testnet-clay ``` -------------------------------- ### Deploy encoded composite to Ceramic node using CLI and JavaScript Source: https://developers.ceramic.network/docs/composedb/guides/data-modeling/composites Deploys an encoded composite to a Ceramic node. The CLI command uses composedb composite:deploy; the JavaScript example reads the encoded composite and calls startIndexingOn on the Ceramic client. Requires admin DID credentials and node URL. ```CLI composedb composite:deploy my-composite.json --ceramic-url=http://localhost:7007 --did-private-key=your-private-key ``` ```JavaScript import { CeramicClient } from '@ceramicnetwork/http-client'\nimport { DID } from 'dids'\nimport { Ed25519Provider } from 'key-did-provider-ed25519'\nimport { getResolver } from 'key-did-resolver'\nimport { fromString } from 'uint8arrays/from-string'\n\nimport { readEncodedComposite } from '@composedb/devtools-node'\\n// Hexadecimal-encoded private key for a DID having admin access to the target Ceramic node\n// Replace the example key here by your admin private key\nconst privateKey = fromString('b0cb[...]515f', 'base16')\n\nconst did = new DID({\n resolver: getResolver(),\n provider: new Ed25519Provider(privateKey),\n})\nawait did.authenticate()\n\n// Replace by the URL of the Ceramic node you want to deploy the Models to\nconst ceramic = new CeramicClient('http://localhost:7007')\n// An authenticated DID with admin access must be set on the Ceramic instance\nceramic.did = did\n\n// Replace by the path to the local encoded composite file\nconst composite = await readEncodedComposite(ceramic, 'my-first-composite.json')\n\n// Notify the Ceramic node to index the models present in the composite\nawait composite.startIndexingOn(ceramic) ``` -------------------------------- ### Download and Run Wheel Tool Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Command to download the Wheel tool, which helps in configuring the Ceramic development environment. Wheel installs dependencies and sets up the working directory. ```Shell curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ceramicstudio/wheel/main/wheel.sh | bash ``` ```Shell ./wheel ``` ```Shell ./wheel --help ``` -------------------------------- ### Install Ceramic CLI with yarn Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Command to install the Ceramic CLI globally using yarn. Note that global packages are only supported for yarn 2.x and older. ```Shell yarn global add @ceramicnetwork/cli ``` -------------------------------- ### Install Ceramic Model Client Packages (npm) Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/produce Installs the necessary Ceramic SDK packages for working with models and model instances, including the model client, model protocol, model instance client, and DID tools for authentication. ```bash npm install --save @ceramic-sdk/model-client @ceramic-sdk/model-protocol @ceramic-sdk/model-instance-client @didtools/key-did ``` -------------------------------- ### Enable and Start logrotate Service Source: https://developers.ceramic.network/docs/protocol/js-ceramic/nodes/running-a-node Enables the logrotate service to start on boot and starts the service immediately. This command ensures that the log rotation configurations are active and applied. ```bash sudo systemctl enable logrotate sudo systemctl start logrotate ``` -------------------------------- ### Install Key DID Resolver - npm Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/authentication/key-did Installs the `key-did-resolver` module, which is necessary for resolving DID documents using the `did:key` method. This is a prerequisite for using DID resolution functionalities. ```bash npm install key-did-resolver ``` -------------------------------- ### Create composite from GraphQL schema using CLI and JavaScript Source: https://developers.ceramic.network/docs/composedb/guides/data-modeling/composites Creates a composite from a GraphQL schema. The CLI command runs composedb composite:create while the JavaScript example uses @composedb/devtools-node to generate and write an encoded composite. Requires a client, DID authentication, and the source schema file. ```CLI composedb composite:create my-schema.graphql --output=my-composite.json --did-private-key=your-private-key ``` ```JavaScript import { CeramicClient } from '@ceramicnetwork/http-client'\nimport { DID } from 'dids'\nimport { Ed25519Provider } from 'key-did-provider-ed25519'\nimport { getResolver } from 'key-did-resolver'\nimport { fromString } from 'uint8arrays/from-string'\n\n// Import the devtool node package\nimport { createComposite, writeEncodedComposite } from '@composedb/devtools-node'\n\n// Hexadecimal-encoded private key for a DID having admin access to the target Ceramic node\n// Replace the example key here by your admin private key\nconst privateKey = fromString('b0cb[...]515f', 'base16')\n\nconst did = new DID({\n resolver: getResolver(),\n provider: new Ed25519Provider(privateKey),\n})\nawait did.authenticate()\n\n// Replace by the URL of the Ceramic node you want to deploy the Models to\nconst ceramic = new CeramicClient('http://localhost:7007')\n// An authenticated DID with admin access must be set on the Ceramic instance\nceramic.did = did\n\n// Replace by the path to the source schema file\nconst composite = await createComposite(ceramic, './source-schema.graphql')\n\n// Replace by the path to the encoded composite file\nawait writeEncodedComposite(composite, './my-composite.json') ``` -------------------------------- ### Install ComposeDB Client with npm, pnpm, or yarn Source: https://developers.ceramic.network/docs/composedb/guides/composedb-client/javascript-client Installs the ComposeDB client package using different package managers. This is a prerequisite for using the client in your JavaScript or TypeScript project. ```bash npm install @composedb/client ``` ```bash pnpm add @composedb/client ``` ```bash yarn add @composedb/client ``` -------------------------------- ### Install Key DID Provider secp256k1 - npm Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/authentication/key-did Installs the `key-did-provider-secp256k1` module, enabling the creation and use of Key DID accounts with secp256k1 keypairs. Note that this provider does not support encryption. ```bash npm install key-did-provider-secp256k1 ``` -------------------------------- ### Install did-session library Source: https://developers.ceramic.network/docs/composedb/guides/composedb-client/user-sessions Install the did-session library using npm, pnpm, or yarn. This library is essential for creating and managing user sessions in Ceramic applications. ```shell npm install did-session ``` ```shell pnpm add did-session ``` ```shell yarn add did-session ``` -------------------------------- ### Check Node.js and pnpm Versions Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Commands to verify the installed versions of Node.js and pnpm, which are required for Ceramic development. ```Shell node -v pnpm -v ``` -------------------------------- ### Ceramic Node Running Confirmation Message Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Output message indicating that the Ceramic API is successfully running. This confirms the node has started correctly. ```text IMPORTANT: Ceramic API running on 0.0.0.0:7007 ``` -------------------------------- ### Install ComposeDB Types for TypeScript Source: https://developers.ceramic.network/docs/composedb/guides/composedb-client/javascript-client Installs the ComposeDB types package as a development dependency for TypeScript projects. This provides type definitions for better developer experience and type safety. ```bash npm install -D @composedb/types ``` ```bash pnpm add -D @composedb/types ``` ```bash yarn add -D @composedb/types ``` -------------------------------- ### Install Key DID Provider ED25519 - npm Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/authentication/key-did Installs the `key-did-provider-ed25519` module, which provides support for creating and using Key DID accounts with ED25519 keypairs. This is the recommended provider for most use cases and supports encryption. ```bash npm install key-did-provider-ed25519 ``` -------------------------------- ### Start Ceramic Node with Flight SQL Enabled Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/query This command starts a Ceramic node with experimental features and Flight SQL enabled. It requires a running ceramic-one daemon and specifies an S3 bucket for data storage. Ensure the `--flight-sql-bind-address` is configured correctly for your network. ```bash ceramic-one --daemon --experimental-features --flight-sql-bind-address 0.0.0.0:5102 --object-store-url s3://your-bucket-name ``` -------------------------------- ### Create Project Directory Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Commands to create and navigate into a new project directory for Ceramic development. ```Shell mkdir my-project cd my-project ``` -------------------------------- ### Run ceramic-one via Docker container Source: https://developers.ceramic.network/docs/protocol/ceramic-one/usage/installation Runs ceramic-one daemon in a Docker container using the host network configuration. Uses the latest AWS ECR-hosted image. The container runs in detached mode with host networking for easy access to the daemon. ```bash docker run --network=host \ public.ecr.aws/r5b3e0r5/3box/ceramic-one:latest ``` -------------------------------- ### Create new post mutation (GraphQL) Source: https://developers.ceramic.network/docs/composedb/guides/data-interactions/mutations GraphQL mutation for creating a new post with required input variables. Returns the created document with specified fields. Includes example variables. ```GraphQL # Create post mutation CreateNewPost($i: CreatePostInput!) { createPost(input: $i) { document{ id title text } } } # Content for the post { "i": { "content": { "title": "Getting started with ComposeDB" "text": "A Post created using composites and GraphQL" } } } ``` -------------------------------- ### List Pinned Streams using cURL Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/javascript-clients/http-api This example shows how to retrieve a list of all streams currently in the node's pinset using cURL. A simple GET request to the /api/v0/pins endpoint is sufficient. ```shell curl http://localhost:7007/api/v0/pins ``` -------------------------------- ### Add Existing Stream to Pinset (JavaScript) Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/javascript-clients/pinning This example shows how to add an already existing stream to your Ceramic node's permanent pinset. It uses the `ceramic.admin.pin.add()` method, requiring the stream's ID as input. This ensures the specified stream will not be garbage collected. ```javascript const streamId = 'kjzl6cwe1jw14...' await ceramic.admin.pin.add(streamId) ``` -------------------------------- ### Setup Project with Ceramic Client and DID Authentication (JavaScript) Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-clients/authentication/did-jsonrpc Imports necessary DID.js modules and the Ceramic client to set up a project for read-only queries. It includes a function to authenticate an account using a seed, which is required for performing transactions. Ensure your provider and wallet are correctly configured. ```javascript import { DID } from 'dids' import { Ed25519Provider } from 'key-did-provider-ed25519' import { getResolver } from 'key-did-resolver' import { CeramicClient } from '@ceramicnetwork/http-client' // Connect to a Ceramic node const API_URL = 'https://your-ceramic-node.com' // Create the Ceramic object const ceramic = new CeramicClient(API_URL) async function authenticateCeramic(seed) { // Activate the account by somehow getting its seed. // See further down this page for more details on // seed format, generation, and key management. const provider = new Ed25519Provider(seed) // Create the DID object const did = new DID({ provider, resolver: getResolver() }) // Authenticate with the provider await did.authenticate() // Mount the DID object to your Ceramic object ceramic.did = did } ``` -------------------------------- ### Initialize Ceramic Deployment Repository Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-nodes/running-cloud Clones the SimpleDeploy repository and navigates to the ceramic-one configuration directory. This provides the necessary Kubernetes manifests and configuration files for deploying Ceramic nodes. ```bash git clone https://github.com/ceramicstudio/simpledeploy.git cd simpledeploy/k8s/base/ceramic-one ``` -------------------------------- ### Programmatically Alias Models with ComposeDB Devtools Source: https://developers.ceramic.network/docs/composedb/guides/data-modeling/composites This Javascript example demonstrates how to programmatically set aliases for models using the ComposeDB Devtools library. It reads an existing composite, sets aliases using a mapping of streamIDs to names, and writes the updated composite to a new file. Dependencies include '@ceramicnetwork/http-client', '@composedb/devtools', and '@composedb/devtools-node'. ```javascript import { CeramicClient } from '@ceramicnetwork/http-client' import { Composite } from '@composedb/devtools' import { readEncodedComposite, writeEncodedComposite } from '@composedb/devtools-node' const ceramic = new CeramicClient('http://localhost:7007') const sourceComposite = await readEncodedComposite(ceramic, 'merged-composite.json') const newComposite = sourceComposite.setAliases({ 'kjzl6hvfrbw6c5i55ks5m4hhyuh0jylw4g7x0asndu97i7luts4dfzvm35oev65': 'SimpleProfile', 'kjzl6hvfrbw6c822s0cj1ug59spj648ml8a6mbqaz91wx8zx3mlwi76tfh3u1dy': 'Post', }) await writeEncodedComposite(newComposite, 'new-composite.json') ``` -------------------------------- ### Configure and Instantiate ComposeDB Client Source: https://developers.ceramic.network/docs/composedb/guides/composedb-client/javascript-client Demonstrates how to import the ComposeDB client and definition, then create a new ComposeClient instance. It requires the Ceramic server URL and the compiled composite definition. ```javascript // Import ComposeDB client import { ComposeClient }from '@composedb/client' // Import your compiled composite import { definition }from './__generated__/definition.js' // Create an instance of ComposeClient // Pass the URL of your Ceramic server // Pass reference to your compiled composite const compose = new ComposeClient({ ceramic: 'http://localhost:7007', definition }) ``` -------------------------------- ### Configure Ceramic Node Admin DIDs and Indexing Settings Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Example JSON configuration for a Ceramic node. It shows how to set the administrator DIDs for the HTTP API and enable queries before historical sync. ```json { ... "http-api": { ... "admin-dids": ["did:key:z6MkoDgemAx51v8w692aZRLPdwP6UPKj3EgUhBTvbL7hCwLu"] }, "indexing": { ... "allow-queries-before-historical-sync": true } } ``` -------------------------------- ### Apply Kubernetes Manifests Source: https://developers.ceramic.network/docs/protocol/js-ceramic/guides/ceramic-nodes/running-cloud Deploys all Kubernetes resources using Kustomize configuration from the current directory. This creates the ceramic-one, js-ceramic, and PostgreSQL services within the specified namespace. ```bash kubectl apply -k . ``` -------------------------------- ### Install blockchain wallet modules Source: https://developers.ceramic.network/docs/composedb/guides/composedb-client/user-sessions Install the appropriate blockchain wallet module for Ethereum or Solana accounts using npm, pnpm, or yarn. These modules are required for wallet-based authentication. ```shell npm install @didtools/pkh-ethereum ``` ```shell npm install @didtools/pkh-solana ``` ```shell pnpm add @didtools/pkh-ethereum ``` ```shell pnpm add @didtools/pkh-solana ``` ```shell yarn add @didtools/pkh-ethereum ``` ```shell yarn add @didtools/pkh-solana ``` -------------------------------- ### Navigate to Ceramic Node Configuration Directory Source: https://developers.ceramic.network/docs/composedb/set-up-your-environment Command to change the directory to where the Ceramic node configuration files are stored. This is a prerequisite for editing the configuration. ```bash cd ~/.ceramic ``` -------------------------------- ### Install logrotate for Node Log Management Source: https://developers.ceramic.network/docs/protocol/js-ceramic/nodes/running-a-node Installs the logrotate utility using apt, which is essential for managing log files generated by the Ceramic node to prevent disk overfill. This is a system-level operation. ```bash sudo apt install logrotate ``` -------------------------------- ### Install Cross-Eventsource Dependency Source: https://developers.ceramic.network/docs/protocol/js-ceramic/networking/data-feed-api Installs the 'cross-eventsource' package, which allows the use of the EventSource interface both in Node.js and browser environments. This is a prerequisite for using the Data Feed API with real-time event streams. ```bash npm i cross-eventsource ``` -------------------------------- ### Install Ceramic Codecs Dependencies Source: https://developers.ceramic.network/docs/protocol/js-ceramic/networking/data-feed-api Installs '@ceramicnetwork/codecs' and 'codeco' for encoding and decoding data when interacting with Ceramic network streams. These packages are essential for processing the data received from the Data Feed API. ```bash npm i @ceramicnetwork/codecs codeco ```