Cedalio
Search
K

Create a Database

Cedalio offers two methods for creating a database: through the studio interface or via our API (useful for the case of one database per user). In either case, a Wallet is required to serve as the owner of the database. The Wallet has exclusive privileges to modify the smart contract responsible for managing access control to the data. This wallet becomes essential for subsequent tasks such as signing up and obtaining a valid JWT necessary for executing operations against the schema.
Similarly, when accessing the explorer, you will have to authenticate using the same wallet that was employed during the creation of the database.

Create a database from the Studio

Once the project is created, you have to deploy a new database based on the provided GraphQL schema. Cedalio automatically creates all the resolvers and everything needed to start operating right away.

Create a database from Cedalio's API

For users opting for the user owned data strategy, deploying a new database is a part of the signup process for each new user. To accomplish this, the user must generate a valid JWT, which serves as the authorization token for database operations.
Request
Response
curl -H 'Authorization: Bearer $CEDALIO_JWT' "https://$PROJECT_ID.gtw.cedalio.io/deploy"
{
"deployment_id":"9230b2d2-aa7c-98e2-ad5e-9926ec31e299"
}
PROJECT_ID can be obtained from the project overview inside the Studio.
The response of this endpoint is immediate, while the background process of deploying the database and Smart Contract begins. To receive updates of deployment process, users have the option to subscribe to the Pusher channel using the corresponding DEPLOYMENT_ID.
By subscribing to the channel, users can stay up to date with incoming events DEPLOYMENT_STATUS_UPDATE, specifically the READY or FAILED messages, which indicate the progress and status of the Smart Contract deployment.
Pusher event example
{
"event": "DEPLOYMENT_STATUS_UPDATE",
"data":"{
\"created_at\":\"2023-07-06T14:45:40.874403007Z\",
\"database_contract\":\"0x9c493e4f0a7265d3844d06e8ebc0184647f1bf84\",
\"delegate\":\"0xbeb888b0601304539a20f6928bddc28485a5646c\",
\"deployment_id\":\"c497772d-1e37-43f2-be80-03bcccd1ae9c\",
\"owner\":\"0x305d4bcae378094f1923f8bb352824d9496510b1\",
\"status\":\"READY\"
}",
"channel": "c497772d-1e37-43f2-be80-03bcccd1ae9c"
}