Getting started
Welcome to Context Protocol.
🚀 Introduction
Context is an abstraction layer designed to integrate Web3 storage technologies, providing distinctive features that enhance data management. Dive into creation with our SDK, which helps users to organize, read and share public and private data in a sovereign, trusted, and verified way. Saying goodbye to hashes, and embracing domains and documents within the blockchain ecosystem. We empower developers to innovate, providing the tools you need to build groundbreaking applications on top of our platform.
Every data on Context is publicly available, free, and forever for other developers to use locally through our public gateway - i.e. rpc.ctx.xyz/contextprotocol
⚡ Getting started
Install the SDK
Install the Context SDK to your TypeScript project using npm:
Setting Up Your Connection
To use Context, you always need a domain. This domain acts as your namespace within Context, where all your documents will be stored. Then, you'll need to obtain an API key for your domain.
You can claim your domain and generate the API key by creating an account at app.ctx.xyz.
Initialize the SDK:
🌐 Working with Domains
Domains represent verified and curated entities, such as companies, projects, or individuals.
Fetch Domain Information
Fetch details of a specific domain or the default domain associated with your API key:
Domain Properties
Access and display properties of a domain:
📄 Managing Documents
Fetch Documents
Fetch a specific document or template or asset, from any domain:
Document Properties
Access and display properties of a document:
List Document Versions
Fetch a list of all versions of a document:
Fetch a Specific Document Version
You can fetch a specific version of a document in two different ways:
Create a Document
Steps to create a new document within a domain:
Update a Document
Update an existing document:
Adding Metadata to a Document
You can add metadata to a document using the addMetadata
method. The metadata object should contain the following (optional) fields: name
, description
, and readme
as shown below:
📐 Creating Templates
Define a JSON Schema for a Template
Create a JSON schema directly or from a TypeScript interface:
Create a New Template
Use the defined schema to create a new template:
Installing Templates
Once we have the template, we can install it in a document by using the install
method:
Uninstalling Templates
To uninstall a template from a document, we can use the uninstall
method:
📦 Assets
Upload new Assets
As a user, you can upload assets to your domain. When uploading an asset, you can specify the document path where the asset will be stored.
Update an Asset
You can update an existing asset by providing the document path and the local file path of the updated asset. It returns a document with a new version.
🌐 Accessing Context Data
Every data on Context is publicly available, free, and forever for other developers to use locally through our public gateway:
👨🔧 Error Handling
When calling a function, you can check if an error occurred by checking the error
property in the returned object:
✨ Create your first Domain
We are scheduled to launch on Mainnet in the coming weeks. If you are interested in becoming one of our early users, we encourage you to create your initial domain on our Beta using the WebApp.
For inquiries about creating a premium and verified domain, please contact us at support@ctx.xyz
Last updated