Circular Documentation
  • Getting Started
  • Introduction
    • Introducing Circular
  • Circular's Mission
  • Circular's Technology
    • Certificates & Data Anchoring
    • Multi-Chain Architecture
    • Certified Nodes & Jurisdictional Deployment
    • HyperCode & GPU Accelerated Processing
    • Proof of Reputation Consensus Mechanism
  • Certified Intelligence
  • Developer Tools
    • Enterprise APIs
      • Javascript
        • CEP_Account.open()
        • CEP_Account.setNetwork()
        • CEP_Account.setBlockchain()
        • CEP_Account.update()
        • CEP_Account.submitCertificate()
        • CEP_Account.getTransactionOutcome()
        • CEP_Account.getTransaction()
        • CEP_Account.close()
      • Node.JS
        • CEP_Account.open()
        • CEP_Account.setNetwork()
        • CEP_Account.setBlockchain()
        • CEP_Account.update()
        • CEP_Account.submitCertificate()
        • CEP_Account.getTransactionOutcome()
        • CEP_Account.getTransaction()
        • CEP_Account.close()
      • PHP
        • CEP_Account.open()
        • CEP_Account.setNetwork()
        • CEP_Account.setBlockchain()
        • CEP_Account.updateAccount()
        • CEP_Account.submitCertificate()
        • CEP_Account.getTransactionOutcome()
        • CEP_Account.getTransaction()
        • CEP_Account.close()
      • Python
        • CEP_Account.open()
        • CEP_Account.set_network()
        • CEP_Account.set_blockchain()
        • CEP_Account.update_account()
        • CEP_Account.submit_certificate()
        • CEP_Account.get_transaction_outcome()
        • CEP_Account.get_transaction()
        • CEP_Account.close()
      • Java
        • CEP_Account.open()
        • CEP_Account.setNetwork()
        • CEP_Account.setBlockchain()
        • CEP_Account.updateAccount()
        • CEP_Account.submitCertificate()
        • CEP_Account.getTransactionOutcome()
        • CEP_Account.getTransaction()
        • CEP_Account.close()
  • SDK
  • CLI & Tooling
  • Core Concepts
    • Overview
    • Certificates
  • Accounts
  • Private Chains
  • Data Management
  • Fees
  • Nodes
  • Private Keys
  • Recovery Phrases
  • Tutorials & Examples
    • Circular Connect Guide
      • Create an Organisation Account
      • Create a Blockchain Account
      • Purchase Certificates
      • Using the Explorer & Viewing Certificate Details
    • Create Your First Certificate
  • Industry Use Cases
    • Industry Use Cases - Overview
    • Clinical Trials
    • Medical Devices
    • Public Health
    • Pharma Supply Chains
    • Research and Academia
Powered by GitBook
On this page
  • Introduction
  • Prerequisites
  • Summary
  1. Tutorials & Examples

Create Your First Certificate

Learn how to programmatically create, sign, and anchor your first certificate on Circular using your private key, including hashing, signing, and API submission.

Introduction

This tutorial provides a technical walkthrough for issuing and anchoring your first certificate on Circular using direct cryptographic signing. It assumes access to a valid Circular account with avail

Prerequisites

  1. An active Circular account (with sufficient certificate credits)

  2. The private key associated with your Circular account (locally stored and securely managed)

  3. Node.js or equivalent environment with elliptic and crypto-js modules

  4. A data payload or metadata you wish to certify

1

Install Required Libraries

Make sure the environment has the necessary crypto libraries:

npm install elliptic crypto-js

2

Define the Certificate Metadata

Create a JSON object that describes your certificate:

const certificate = {
  title: "Protocol A Study Consent",
  description: "Signed digital copy of consent form for participant #2045",
  issuer: "0xYourPublicKey",
  timestamp: new Date().toISOString(),
  dataHash: "<sha256 hash of document or payload>"
};

Generate the SHA-256 hash of a document:

const CryptoJS = require("crypto-js");
const fs = require("fs");

const fileBuffer = fs.readFileSync("document.pdf");
const hash = CryptoJS.SHA256(fileBuffer).toString();
certificate.dataHash = hash;

3

Generate a Certificate ID

const certificateId = CryptoJS.SHA256(JSON.stringify(certificate)).toString();

4

Sign the Certificate

Never share your private key.

Your private key is the only way to sign and authorize certificates from your account. Keep it secure, store it offline if possible, and never expose it in client-side code or public repositories.

const EC = require("elliptic").ec;
const ec = new EC("secp256k1");

const privateKey = "<your-private-key>";
const key = ec.keyFromPrivate(privateKey);
const signature = key.sign(certificateId).toDER("hex");

5

Construct the Payload for Submission

const payload = {
  Action: "CP_CREATE",
  CertificateId: certificateId,
  Certificate: certificate,
  Signature: signature,
  From: key.getPublic("hex"),
  Timestamp: certificate.timestamp
};

6

Submit to the Circular Network

const axios = require("axios");

axios.post("https://api.circular.health/submit-certificate", payload)
  .then(response => console.log("Certificate submitted:", response.data))
  .catch(error => console.error("Submission error:", error));

7

Verification and Lookup

You can verify that your certificate was included in the chain:

axios.get(`https://explorer.circular.health/cert/${certificateId}`)
  .then(response => console.log("Certificate verified:", response.data))
  .catch(error => console.error("Verification error:", error));

Summary

This guide walks through:

  • Creating a hash of your data

  • Signing that hash with a private key

  • Submitting the signed payload to the Circular network

  • Verifying that your certificate is anchored and retrievable

In production systems, the Circular SDK handles most of this behind the scenes, but direct signing is useful for low-level integrations, auditing, or custom dApp infrastructure.

PreviousUsing the Explorer & Viewing Certificate DetailsNextIndustry Use Cases - Overview

Last updated 26 days ago