Go to file
2025-07-09 07:04:28 -04:00
public Initial commit from Create Next App 2025-05-02 15:18:41 -04:00
src work in progress 2025-07-09 07:04:28 -04:00
.eslintrc.cjs init, working 2025-05-02 16:05:48 -04:00
.gitignore Initial commit from Create Next App 2025-05-02 15:18:41 -04:00
eslint.config.mjs Initial commit from Create Next App 2025-05-02 15:18:41 -04:00
next.config.ts nice 2025-05-03 09:42:05 -04:00
package-lock.json init, working 2025-05-02 16:05:48 -04:00
package.json init, working 2025-05-02 16:05:48 -04:00
postcss.config.mjs Initial commit from Create Next App 2025-05-02 15:18:41 -04:00
README.md fix 2025-06-26 15:02:28 -04:00
tsconfig.json Initial commit from Create Next App 2025-05-02 15:18:41 -04:00

ATOM Deploy - Laconic Registry

A simple Next.js frontend that allows users to pay in ATOM cryptocurrency (using Keplr wallet) and paste a URL. The transaction hash and URL are used to create records in the Laconic Registry.

Features

  • Keplr wallet integration for ATOM payments
  • URL validation and submission
  • Transaction verification
  • Laconic Registry record creation using official @cerc-io/registry-sdk
  • Automatic salt addition to DNS names to prevent collisions
  • Error handling and validation throughout the application flow

Prerequisites

  • Node.js 18.x or later
  • npm or yarn
  • Keplr wallet browser extension
  • Access to a Laconic Registry node

Environment Variables

Copy the .env.local.example file to .env.local and fill in the required variables:

cp .env.local.example .env.local

Required environment variables:

Client-side (must be prefixed with NEXT_PUBLIC_):

  • NEXT_PUBLIC_RECIPIENT_ADDRESS - The Cosmos address that will receive ATOM payments
  • NEXT_PUBLIC_COSMOS_RPC_URL - The RPC URL for the Cosmos blockchain (used by Keplr for transactions)
  • NEXT_PUBLIC_COSMOS_API_URL - The REST API URL for the Cosmos blockchain (used for transaction queries)
  • NEXT_PUBLIC_COSMOS_CHAIN_ID - The chain ID for Keplr wallet (e.g., cosmoshub-4)
  • NEXT_PUBLIC_DOMAIN_SUFFIX - Optional suffix to append to DNS names in the UI (e.g. ".example.com")
  • NEXT_PUBLIC_EXAMPLE_URL - Example URL to pre-fill in the URL form (e.g. "https://github.com/cerc-io/laconic-registry-cli")

Server-side:

  • REGISTRY_CHAIN_ID - The chain ID for the Laconic Registry
  • REGISTRY_GQL_ENDPOINT - The GraphQL endpoint for the Laconic Registry
  • REGISTRY_RPC_ENDPOINT - The RPC endpoint for the Laconic Registry
  • REGISTRY_BOND_ID - The bond ID to use for Laconic Registry records
  • REGISTRY_AUTHORITY - The authority for Laconic Registry LRNs
  • REGISTRY_USER_KEY - The private key for Laconic Registry transactions
  • APP_NAME - The name of the application (used in record creation)
  • DEPLOYER_LRN - The LRN of the deployer

Installation

npm install

Development

npm run dev

Visit http://localhost:3000 to see the application.

Build for Production

npm run build

Start Production Server

npm start

How It Works

  1. User connects their Keplr wallet to the application
  2. User enters a URL they want to deploy to the Laconic Registry
  3. User completes payment in ATOM to a specified address
  4. The application verifies the transaction using the Cosmos RPC
  5. The application calls a server-side API route which creates records in the Laconic Registry
  6. The server generates a unique DNS name by adding a random salt to prevent name collisions
  7. Two records are created in the Laconic Registry:
    • An ApplicationRecord containing metadata about the URL
    • An ApplicationDeploymentRequest linking the URL, DNS, and payment transaction

Architecture

This application uses a hybrid client/server approach:

  • Client-side: Handles the user interface, Keplr wallet integration, and transaction verification
  • Server-side: Next.js API route handles the communication with the Laconic Registry

This architecture allows us to keep sensitive keys secure on the server side while providing a responsive user experience.

Resource Name Formats

DNS Name Format

The DNS names are generated with the following format:

{sanitized-url-name}-{short-commit-hash}-{random-salt}{domain-suffix}

For example:

  • Basic DNS: github-abc123-xyz789
  • With domain suffix: github-abc123-xyz789.example.com

The random salt ensures that each deployment request has a unique DNS name, even if the same URL is deployed multiple times or by different users. The optional domain suffix allows the application to display a full domain name to users.

Laconic Resource Name (LRN) Format

The Laconic Resource Names (LRNs) are generated with the following format:

lrn://{authority}/applications/{app-name}-{short-commit-hash}-{random-salt}

For example: lrn://atom/applications/github-abc123-xyz789

Including the commit hash and salt in the LRN ensures that each application record has a unique identifier, consistently matching the DNS naming pattern.

Reference Files

This application was built with reference to:

  • snowballtools-base/packages/backend/src/registry.ts
  • hosted-frontends/deploy-atom.sh

Deployment to Production

To deploy this application to production, follow these steps:

  1. Clone the repository
  2. Install dependencies: npm install
  3. Create a production build: npm run build
  4. Set up all required environment variables in your production environment
  5. Start the production server: npm start

For containerized deployments, you can use the following Dockerfile:

FROM node:18-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci

COPY . .
RUN npm run build

EXPOSE 3000

ENV NODE_ENV=production

CMD ["npm", "start"]

Build and run the Docker container:

docker build -t atom-deploy .
docker run -p 3000:3000 --env-file .env.production atom-deploy

Known Issues

  • You may see a deprecated Buffer() warning during build. This comes from dependencies in the registry-sdk. This doesn't affect functionality.
  • If using a custom Cosmos chain, ensure that your RPC endpoint supports CORS for client-side requests.
  • The Keplr wallet integration requires HTTPS in production environments.

Troubleshooting

Keplr Wallet Issues

  • Keplr not detecting: Install the Keplr browser extension and refresh the page.
  • Chain not found in Keplr: The application will attempt to suggest the chain to Keplr, but if that fails, you may need to manually add the chain in your Keplr wallet settings.

Laconic Registry Issues

  • Failed to create record: Check that your REGISTRY_USER_KEY and REGISTRY_BOND_ID are correctly set.
  • Transaction verification errors: Ensure your COSMOS_RPC_URL and COSMOS_API_URL are accessible and return correct transaction data.