### Setting Up SettleMint Asset Tokenization Kit with Pre-deployed Contracts (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/application-kits/asset-tokenization/deployment.mdx This snippet provides the commands to quickly set up the Asset Tokenization Kit using pre-deployed contracts, subgraphs, and ABIs. It covers installing dependencies, authenticating with SettleMint, generating necessary types, and starting the development server. This is the fastest way to get started. ```bash # Install dependencies bun install # Login and connect to SettleMint bunx settlemint login bunx settlemint connect # Generate types and start development server cd kit/dapp bun codegen:settlemint bun addresses bun dev ``` -------------------------------- ### Installing Bun Runtime Source: https://github.com/settlemint/docs/blob/main/README.md This command downloads and executes the official Bun installation script. Bun is a fast JavaScript runtime, package manager, and bundler, which is a prerequisite for running the SettleMint documentation project. ```bash curl -fsSL https://bun.sh/install | bash ``` -------------------------------- ### Running Settlemint DApp Locally Source: https://github.com/settlemint/docs/blob/main/content/docs/application-kits/asset-tokenization/ui-customization.mdx This snippet provides the necessary commands to navigate into the DApp's root directory, install its dependencies using Bun, and start the development server for local testing and previewing changes. ```bash cd kit/dapp bun install bun dev ``` -------------------------------- ### Installing Project Dependencies with Bun Source: https://github.com/settlemint/docs/blob/main/README.md This command uses Bun, acting as a package manager, to install all necessary project dependencies. It reads the project's `package.json` or equivalent configuration to fetch and install required modules, ensuring the project can run correctly. ```bash bun install ``` -------------------------------- ### Running Built Application in Production Mode Source: https://github.com/settlemint/docs/blob/main/README.md This command starts the SettleMint documentation application using the previously built production assets. It runs the optimized version of the application, suitable for live environments, often with performance enhancements and without development tools. ```bash bun run start ``` -------------------------------- ### Starting Development Server with Hot-Reload Source: https://github.com/settlemint/docs/blob/main/README.md This command initiates the development server for the SettleMint documentation project. It typically includes hot-reloading capabilities, allowing developers to see changes reflected in the browser instantly without manually restarting the server after code modifications. ```bash bun run dev ``` -------------------------------- ### Cloning SettleMint Documentation Repository Source: https://github.com/settlemint/docs/blob/main/README.md This command sequence first clones the SettleMint documentation repository from GitHub to your local machine. After cloning, it changes the current directory into the newly created project folder, preparing for subsequent steps like dependency installation. ```bash git clone https://github.com/settlemint/docs cd yourproject ``` -------------------------------- ### Installing Krew Support Bundle Plugin (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This command uses `curl` to download and execute a script that installs the `support-bundle` plugin for `kubectl` via Krew. This plugin is a prerequisite for generating a comprehensive support bundle for troubleshooting. ```bash curl https://krew.sh/support-bundle | bash ``` -------------------------------- ### Example Hasura CLI Project Configuration (config.yaml) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-offchain-database.mdx An example `config.yaml` demonstrating how to configure the Hasura CLI with a specific endpoint and admin secret. This setup is crucial for connecting the local Hasura CLI project to a remote Hasura instance for operations like metadata management. ```YAML endpoint: https://hasuradb-15ce.gke-japan.settlemint.com/sm_aat_86530f5bf93d82a9 admin_secret: dc5eb1b93f43fd28c53e metadata_directory: metadata actions: kind: synchronous handler_webhook_baseurl: http://localhost:3000 ``` -------------------------------- ### Complete Example Configuration for Settlemint Platform (YAML) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This comprehensive YAML configuration example demonstrates a full set of `values` for deploying the Settlemint platform. It includes detailed settings for ingress (host, annotations, TLS), external services like Redis and PostgreSQL (host, port, credentials), authentication providers (Google OAuth), Vault integration, and various platform features such as observability (metrics, logs) and the deployment engine. The deployment engine configuration covers domain settings, state management with S3-compatible, AWS, Azure, and Google Cloud credentials, and defines target clusters for deployments. ```yaml ingress: enabled: true className: "nginx" host: "example.company.com" annotations: nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/proxy-ssl-server-name: "on" nginx.ingress.kubernetes.io/proxy-body-size: "500m" nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" nginx.ingress.kubernetes.io/ssl-redirect: "false" cert-manager.io/cluster-issuer: "letsencrypt" tls: - secretName: "example-tls" hosts: - "example.company.com" - "*.example.company.com" redis: host: "redis.example.local" port: "6379" password: "abc123password" tls: true postgresql: host: "postgresql.example.local" port: "5432" user: "db_user" password: "xyz789password" database: "platform_db" sslMode: require auth: jwtSigningKey: "abc123jwt456xyz789signing000key111example" providers: google: enabled: true clientID: "example-123456789.apps.googleusercontent.com" clientSecret: "abcdef-example-google-secret" vault: address: "http://vault.example.local:8200" roleId: "abc123-role-id" secretId: "xyz789-secret-id" namespace: "vault" features: observability: metrics: enabled: true apiUrl: "http://metrics.example.local/api/v1" logs: enabled: true apiUrl: "http://logs.example.local/api/v1" deploymentEngine: platform: domain: hostname: "example.company.com" state: connectionUrl: "s3-compatible-endpoint-url" secretsProvider: "passphrase" credentials: encryptionKey: "abc123encryption456key789example000key" aws: accessKeyId: "EXAMPLEKEYID123456" secretAccessKey: "abc123example456secret789key000aws" region: "us-east-1" azure: storageAccount: "example-storage-account" storageKey: "abc123example456key789key000azure" google: project: "example-project-id" credentials: |- { "type": "service_account", "project_id": "your-project", "private_key_id": "key-id", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n", "client_email": "service-account@project.iam.gserviceaccount.com", "client_id": "client-id", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account@project.iam.gserviceaccount.com" } targets: - id: "example" name: "Example Cluster" icon: "kubernetes" clusters: - id: "main" name: "Main" icon: "global" location: lat: 0.0000 lon: 0.0000 connection: sameCluster: enabled: true namespace: single: name: "example" domains: service: tls: true hostname: "example.company.com" ``` -------------------------------- ### Installing Loki and Promtail with Helm (Lightweight Stack) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/metrics-and-logs.mdx This command installs Loki using Helm, configuring it for a lightweight setup. It disables authentication, sets a replication factor of 1, and uses filesystem storage, deploying it into the 'observability' namespace. Promtail is typically included with the Loki chart to collect logs. ```bash helm install loki loki \ --repo https://grafana.github.io/helm-charts \ --namespace observability \ --create-namespace \ --set loki.auth_enabled=false \ --set loki.commonConfig.replication_factor=1 \ --set loki.storage.type=filesystem ``` -------------------------------- ### Installing AWS SDK for Go for MinIO Integration Source: https://github.com/settlemint/docs/blob/main/content/docs/platform-components/database-and-storage/s3-storage.mdx These `go get` commands install the necessary AWS SDK for Go packages required to interact with MinIO's S3-compatible API. The packages include core AWS utilities, credential management, session handling, and the S3 service client. ```Bash go get github.com/aws/aws-sdk-go/aws go get github.com/aws/aws-sdk-go/aws/credentials go get github.com/aws/aws-sdk-go/aws/session go get github.com/aws/aws-sdk-go/service/s3 ``` -------------------------------- ### Upgrading Bun Runtime for Troubleshooting Source: https://github.com/settlemint/docs/blob/main/README.md This command updates the Bun runtime to its latest available version. It is a recommended troubleshooting step to ensure that any issues encountered are not due to an outdated Bun installation, providing access to the latest features and bug fixes. ```bash bun upgrade ``` -------------------------------- ### Example: Creating Smart Contract Set on Platform (CLI) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-code-studio.mdx This is a concrete example demonstrating how to use the 'settlemint platform create smart-contract-set' command. It shows typical values for the smart contract set name, application, template, and deployment plan. ```bash settlemint platform create smart-contract-set my-scset \ --application my-app \ --template default \ --deployment-plan starter ``` -------------------------------- ### Navigating to Terraform DNS Zone Configuration Directory Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Changes the current directory to the Terraform configuration for DNS zone setup within the cloned repository, preparing for DNS resource deployment. ```bash cd tutorial-btp-on-gcp/00_dns_zone ``` -------------------------------- ### Cloning the Platform Tutorial Repository Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Clones the SettleMint tutorial repository for deploying the platform on GCP, providing the necessary Terraform configurations. ```bash git clone git@github.com:settlemint/tutorial-btp-on-gcp.git ``` -------------------------------- ### Installing go-ipfs-api via go get Source: https://github.com/settlemint/docs/blob/main/content/docs/platform-components/database-and-storage/ipfs-storage.mdx This command fetches and installs the official Go client library for the IPFS HTTP API using `go get`. It is a required dependency for Go applications that need to interact with IPFS. ```bash go get github.com/ipfs/go-ipfs-api ``` -------------------------------- ### Installing Google Cloud SDK and Authenticating (macOS) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Installs the Google Cloud SDK on macOS using Homebrew Cask and authenticates the application default credentials, enabling interaction with GCP services. ```bash brew cask install google-cloud-sdk gcloud auth application-default login ``` -------------------------------- ### Hardhat UserData Test Suite Setup - TypeScript Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/deploy-smart-contracts.mdx This snippet sets up the Hardhat test suite for the `UserData` smart contract. It includes necessary imports, defines a `deployUserFixture` function to deploy the contract and retrieve a wallet client, and declares a `sampleProfile` object used across various tests. ```TypeScript import { loadFixture } from "@nomicfoundation/hardhat-toolbox-viem/network-helpers"; import { expect } from "chai"; import hre from "hardhat"; // Describe our test suite for the UserData contract describe("UserData", function () { // deployUserFixture deploys the UserData contract using viem and returns the deployed contract instance // along with the address of the first wallet client. async function deployUserFixture() { // Deploy the UserData contract using viem. // The contract name ("UserData") must match your contract's name. const userContract = await hre.viem.deployContract("UserData"); // Get the first wallet client's account address to use as a signer for simulate calls. const account = (await hre.viem.getWalletClients())[0].account.address; return { userContract, account }; } // Define a sample user profile object for tests. const sampleProfile = { userId: 1n, // BigInt literal is used for user IDs name: "Alice", email: "alice@example.com", age: 30, country: "Wonderland", isKYCApproved: true, }; ``` -------------------------------- ### Building Application for Production Use Source: https://github.com/settlemint/docs/blob/main/README.md This command executes the build process for the SettleMint documentation application. It compiles, optimizes, and bundles all necessary assets and code into a production-ready format, typically for deployment to a web server. ```bash bun run build ``` -------------------------------- ### Installing VictoriaMetrics with Helm (Lightweight Stack) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/metrics-and-logs.mdx This command installs or upgrades VictoriaMetrics Single using Helm. It configures the chart to enable server scraping and deploys it into the 'observability' namespace, creating it if it doesn't exist. This is part of the recommended lightweight monitoring stack. ```bash helm upgrade --install victoria-metrics victoria-metrics-single \ --repo https://victoriametrics.github.io/helm-charts/ \ --namespace observability \ --create-namespace \ --set server.scrape.enabled=true ``` -------------------------------- ### Logging into SettleMint Helm Registry (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This command authenticates with the SettleMint Helm registry at `harbor.settlemint.com`. It requires a valid username and password, which should be replaced with your provided credentials, to enable pulling Helm charts for platform installation. ```bash helm registry login harbor.settlemint.com --username --password ``` -------------------------------- ### Generating SettleMint Cluster Support Bundle (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This `kubectl` command, utilizing the previously installed `support-bundle` plugin, generates a detailed support bundle. The bundle includes cluster specifications and diagnostic information, which can be sent to support for assistance with complex issues. ```bash kubectl support-bundle --load-cluster-specs ``` -------------------------------- ### Installing SettleMint Platform with Helm (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This bash command uses Helm to install or upgrade the SettleMint platform. It specifies the OCI registry path, sets the namespace to 'SettleMint', defines the chart version as 7.0.0, creates the namespace if it doesn't exist, and applies configurations from a 'values.yaml' file. ```bash helm upgrade --install SettleMint oci://registry.settlemint.com/settlemint-platform/SettleMint \ --namespace SettleMint \ --version 7.0.0 \ --create-namespace \ --values values.yaml ``` -------------------------------- ### Initializing and Applying Terraform for DNS Zone Creation Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Initializes the Terraform working directory and applies the configuration to create the necessary DNS zone resources on Google Cloud Platform. ```bash terraform init terraform apply ``` -------------------------------- ### Initializing and Applying Terraform for Platform Infrastructure Deployment Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Initializes the Terraform working directory and applies the configuration to deploy the core platform infrastructure components on Google Cloud Platform. ```bash terraform init terraform apply ``` -------------------------------- ### Installing Kube-State-Metrics with Helm Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/metrics-and-logs.mdx This command installs kube-state-metrics using Helm, which provides metrics about the health and state of Kubernetes objects. It deploys the component into the 'observability' namespace, creating it if necessary, to enhance cluster monitoring. ```bash helm install kube-state-metrics kube-state-metrics \ --repo https://prometheus-community.github.io/helm-charts \ --namespace observability \ --create-namespace ``` -------------------------------- ### Rendering Off-Chain Database and Storage Steps with JSX Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/getting-started.mdx This JavaScript/JSX snippet dynamically renders table rows from an array, outlining steps for configuring off-chain services in Settlemint. It covers adding Hasura for PostgreSQL, integrating MinIO or IPFS for file storage, and enabling Integration Studio for custom APIs, with links to detailed guides. ```JavaScript [ "21", "Add Hasura to provision a PostgreSQL database with GraphQL APIs.", "Setup hasura", "/documentation/building-with-settlemint/evm-chains-guide/setup-offchain-database" ], [ "22", "Add MinIO or IPFS for centralized/decentralized file storage.", "Add storage", "/documentation/building-with-settlemint/evm-chains-guide/setup-storage" ], [ "23", "Enable Integration Studio for creating custom APIs and flows", "Add integration studio", "/documentation/building-with-settlemint/evm-chains-guide/integration-studio" ] ].map(([step, action, link, url]) => ( {step} {action} {link} )) ``` -------------------------------- ### Verifying SettleMint Pods Status (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This bash command uses `kubectl` to list all pods within the 'settlemint' namespace. It is used to verify that all platform components are running and ready after installation. ```bash kubectl get pods -n settlemint ``` -------------------------------- ### Installing Hashicorp Terraform (macOS) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Installs Hashicorp Terraform on macOS using Homebrew. This is a prerequisite for managing infrastructure with Terraform. ```bash brew tap hashicorp/tap brew install hashicorp/tap/terraform ``` -------------------------------- ### Installing Redis with Helm (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/redis.mdx This command installs a standalone Redis instance using the Bitnami Helm chart from the Docker OCI registry. It specifies the namespace, version, and sets a secure password for Redis, creating the namespace if it doesn't exist. ```Bash helm upgrade --install redis oci://registry-1.docker.io/bitnamicharts/redis \ --namespace redis \ --version 18.19.2 \ --create-namespace \ --set architecture=standalone \ --set global.redis.password=your-secure-password ``` -------------------------------- ### Configuring Subgraph Data Sources (JSON) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-graph-middleware.mdx This JSON configuration file, `subgraph.config.json`, is foundational for subgraph generation. It specifies the output path, the target blockchain chain ID, and an array of data sources. Each data source defines a contract to be indexed, including its name, deployed address, the block number to start indexing from, and the module folder containing its specific YAML manifest and mapping logic. ```JSON { "output": "generated/scs.", "chain": "44819", "datasources": [ { "name": "UserData", "address": "0x8b1544B8e0d21aef575Ce51e0c243c2D73C3C7B9", "startBlock": 0, "module": ["userdata"] } ] } ``` -------------------------------- ### Defining Subgraph Manifest with Event Handlers (YAML) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-graph-middleware.mdx This YAML manifest file, `userdata.yaml`, instructs the subgraph on how to interact with a specific smart contract. It defines the contract's ABI, address, and the starting block for indexing under the `source` section. The `mapping` section details the API version, language (AssemblyScript), entities, ABI file paths, and crucial `eventHandlers` that link contract event signatures to specific processing functions. ```YAML - kind: ethereum/contract name: { id } network: { chain } source: address: "{address}" abi: UserData startBlock: { startBlock } mapping: kind: ethereum/events apiVersion: 0.0.5 language: wasm/assemblyscript entities: - UserProfile - ProfileCreated - ProfileUpdated - ProfileDeleted abis: - name: UserData file: "{root}/out/UserData.sol/UserData.json" eventHandlers: - event: ProfileCreated(indexed uint256,string,string,uint8,string,bool) handler: handleProfileCreated - event: ProfileUpdated(indexed uint256,string,string,uint8,string,bool) handler: handleProfileUpdated - event: ProfileDeleted(indexed uint256) handler: handleProfileDeleted file: { file } ``` -------------------------------- ### Installing MinIO with Helm Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/storage.mdx This command installs MinIO using Helm, configuring it with a default bucket named 'platform-bucket', root user credentials ('admin' and 'your-secure-password'), and provisioning settings for the 'us-east-1' region. It also ensures the 'minio' namespace is created if it doesn't exist. ```Bash helm upgrade --install minio oci://registry-1.docker.io/bitnamicharts/minio --namespace minio --version 13.8.4 --create-namespace --set defaultBuckets=platform-bucket --set auth.rootUser=admin --set auth.rootPassword=your-secure-password --set provisioning.enabled=true --set "provisioning.config[0].name=region" --set "provisioning.config[0].options.name=us-east-1" ``` -------------------------------- ### Installing boto3 for Python Source: https://github.com/settlemint/docs/blob/main/content/docs/platform-components/database-and-storage/s3-storage.mdx This snippet shows how to install the boto3 library using pip, which is the official AWS SDK for Python and is used to interact with MinIO's S3-compatible API. ```bash pip install boto3 ``` -------------------------------- ### Installing Prometheus Stack with Helm (Full Stack) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/metrics-and-logs.mdx This command installs or upgrades the full kube-prometheus-stack using Helm. This stack includes Prometheus, Grafana, and other components for comprehensive Kubernetes monitoring, deployed into the 'observability' namespace. ```bash helm upgrade --install monitoring prometheus-community/kube-prometheus-stack \ --namespace observability \ --create-namespace ``` -------------------------------- ### Navigating to Terraform Infrastructure Configuration Directory Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Changes the current directory to the Terraform configuration for the main platform infrastructure, preparing for the deployment of core GCP resources. ```bash cd ../01_infrastructure ``` -------------------------------- ### Configuring Ingress Settings for Platform Installation (YAML) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/ingress-controller.mdx This YAML snippet defines basic ingress settings required for platform installation. It enables ingress and specifies `nginx` as the ingress class name. Further ingress configurations related to domain and TLS will be set in a separate section. ```yaml ingress: enabled: true className: nginx # Other ingress settings will be configured in Domain & TLS section ``` -------------------------------- ### Installing AWS SDK for JavaScript Source: https://github.com/settlemint/docs/blob/main/content/docs/platform-components/database-and-storage/s3-storage.mdx This snippet shows how to install the AWS SDK for JavaScript using either npm or Bun, which is required to interact with MinIO's S3-compatible API in Node.js or browser environments. ```bash npm install aws-sdk # or bun add aws-sdk ``` -------------------------------- ### Deploying ERC721 Contract and Claiming Reserves (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/use-case-guides/template-libraries/evm-smart-contracts/erc721.mdx This Bash command executes the `smartcontract:deploy:setup` script, which is responsible for deploying the ERC721 contract and claiming the initial reserve tokens. This step is part of the 'Phase 1: Initial Setup' process, ensuring the contract is live and initial tokens are allocated as configured. ```bash yarn smartcontract:deploy:setup ``` -------------------------------- ### Installing PostgreSQL with Helm Chart Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/postgresql.mdx This command installs or upgrades the Bitnami PostgreSQL Helm chart. It deploys PostgreSQL into the 'postgresql' namespace, creates the namespace if it doesn't exist, and sets the initial username, password, and database name for the 'platform' user. This is suitable for self-hosted production environments. ```bash helm upgrade --install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql \ --namespace postgresql \ --version 14.3.3 \ --create-namespace \ --set global.postgresql.auth.username=platform \ --set global.postgresql.auth.password=your-secure-password \ --set global.postgresql.auth.database=platform ``` -------------------------------- ### Verifying DNS Delegation with dig Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/terraform.mdx Uses the `dig` command to query the Name Server (NS) records for the specified subdomain, confirming that DNS delegation to Google nameservers is correctly configured. ```bash dig NS btp.settlemint.com ``` -------------------------------- ### Example Curl Command for Hasura Database Export Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-offchain-database.mdx An example `curl` command demonstrating how to export a Hasura database using a specific admin secret and endpoint. This command generates a SQL dump file (`db.sql`) containing the database schema and data. ```Bash curl -d '{"opts": [ "-O", "-x", "--schema=public", "--inserts"], "clean_output": true, "source": "default"}' -H "x-hasura-admin-secret:78b0e4618125322de0eb" https://fuchsiacapybara-7f70.gke-europe.settlemint.com/bpaas-1d79Acd6A2f112EA450F1C07a372a7D582E6121F/v1alpha1/pg_dump > db.sql ``` -------------------------------- ### Starting a Blockchain Node with Docker Compose (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/platform-components/platform-info/connect-external-node.mdx This command uses Docker Compose to start the services defined in your `docker-compose.yml` file in detached mode. It's the initial step to bring up your blockchain node, enabling it to discover peers and begin synchronizing the chain. Ensure your `docker-compose.yml` is correctly configured before execution. ```bash docker compose up -d ``` -------------------------------- ### Packaging Hyperledger Fabric Chaincode Source: https://github.com/settlemint/docs/blob/main/content/docs/knowledge-bank/fabric-transaction-flow.mdx Command to package a Hyperledger Fabric chaincode into a `.tar.gz` archive. This step prepares the chaincode for installation on peers, specifying its path, language, and a unique label. ```Bash peer lifecycle chaincode package hello.tar.gz \ --path ./hello --lang golang --label hello_1 ``` -------------------------------- ### Configuring Cluster Connection Settings (YAML) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This YAML snippet defines connection settings for the SettleMint platform to target Kubernetes clusters. It illustrates options for connecting to the same cluster (disabled in this example) or enabling connection via kubeconfig. ```YAML connection: sameCluster: enabled: false kubeconfig: enabled: true ``` -------------------------------- ### Configuring Google OAuth Authorized JavaScript Origin Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/oauth.mdx This snippet shows an example of an authorized JavaScript origin required for Google OAuth setup. It specifies the domain from which your application will make OAuth requests. Replace `your-domain.com` with your actual platform domain. ```plaintext https://your-domain.com ``` -------------------------------- ### Managing Local Smart Contract Sets (CLI) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-code-studio.mdx After creating a smart contract set locally, these commands provide various functionalities for development and testing. They include showing all available commands, and specific commands for building, testing, and managing subgraphs using Foundry or Hardhat. ```bash settlemint scs -h # Show all available commands # Main commands: settlemint scs create # Create a new smart contract set settlemint scs foundry # Foundry commands for building and testing settlemint scs hardhat # Hardhat commands for building, testing and deploying settlemint scs subgraph # Commands for managing TheGraph subgraphs ``` -------------------------------- ### Creating Local Smart Contract Set (CLI) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-code-studio.mdx This command initiates the creation of a new smart contract set in your local development environment. It will prompt you for a project name and allow you to select from a list of available smart contract templates, useful for local development and testing. ```bash # Create a new smart contract set settlemint scs create # You'll see the SettleMint ASCII art and then be prompted: ✔ What is the name of your new SettleMint project? my awesome project # Choose from available templates: ❯ ERC20 token Empty typescript Empty typescript with PDC ERC1155 token ERC20 token with crowdsale mechanism ERC20 token with MetaTx ERC721 # ... and more ``` -------------------------------- ### Testing Integration Studio API Endpoint with cURL (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/integration-studio.mdx This cURL command provides an example of how to test the deployed Integration Studio API endpoint. It sends an HTTP GET request to the `/getLatestBlock` endpoint, including the necessary `x-auth-token` authorization header with a placeholder for the integration key. ```bash curl -H "x-auth-token: bpaas-YOUR_INTEGRATION_KEY_HERE" https://YOUR_INTEGRATION_STUDIO_API_URL.settlemint.com/getLatestBlock ``` -------------------------------- ### Platform Helm Chart Configuration (values.yaml) - YAML Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This YAML snippet defines the `values.yaml` file used to configure the platform's Helm chart. It includes settings for ingress, Redis, PostgreSQL, authentication providers (Google, Microsoft Entra ID), Vault integration, observability (metrics, logs), deployment engine parameters, and image pull credentials. Placeholders like `` and `` must be replaced with actual values. ```YAML ingress: enabled: true className: "nginx" host: '' annotations: nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/proxy-ssl-server-name: "on" nginx.ingress.kubernetes.io/proxy-body-size: "500m" nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" nginx.ingress.kubernetes.io/ssl-redirect: "false" cert-manager.io/cluster-issuer: "letsencrypt" # If using cert-manager tls: - secretName: 'platform-tls' hosts: - '' - '*.' redis: host: '' port: '' password: '' tls: true postgresql: host: '' port: '' user: '' password: '' database: '' sslMode: require auth: jwtSigningKey: '' providers: google: enabled: true clientID: '' clientSecret: '' microsoftEntraId: enabled: true clientID: '' clientSecret: '' tenantId: '' vault: address: '' roleId: '' secretId: '' namespace: 'vault' features: observability: metrics: enabled: true apiUrl: '' logs: enabled: true apiUrl: '' deploymentEngine: platform: domain: hostname: '' clusterManager: domain: hostname: '' state: connectionUrl: 's3://?region=' secretsProvider: 'passphrase' credentials: encryptionKey: '' aws: accessKeyId: '' secretAccessKey: '' region: '' # azure: # # -- Azure storage account name # storageAccount: '' # # -- Azure storage account key # storageKey: '' targets: - id: '' name: '' icon: '' clusters: - id: '' name: '' icon: '' location: lat: '' lon: '' connection: sameCluster: enabled: true namespace: single: name: '' domains: service: tls: true hostname: '' storage: storageClass: '' ingress: ingressClass: '' capabilities: mixedLoadBalancers: false app: replicaCount: '' api: replicaCount: '' existingSecret: '' job: resources: requests: cpu: '' memory: '' autoscaling: enabled: true deployWorker: resources: requests: cpu: '' memory: '' autoscaling: enabled: true clusterManager: replicaCount: '' docs: replicaCount: '' imagePullCredentials: registries: harbor: enabled: true registry: "harbor.settlemint.com" username: '' password: '' email: '' support: kubernetes-replicator: enabled: true features: billing: enabled: false alerting: slack: enabled: false webhookUrl: '' stripe: apiSecret: '' webhookSecret: '' webhookUrl: '' apiLiveMode: false taxRateId: '' publishableKey: '' autoDelete: enabled: false emailUsageExcel: enabled: true privateKeys: hsm: awsKms: enabled: false txsigner: image: registry: ghcr.io repository: settlemint/btp-signer tag: '7.6.10' networks: besu: image: registry: docker.io repository: hyperledger/besu tag: '24.12.2' quorum: image: registry: docker.io repository: quorumengineering/quorum tag: '24.4.1' geth: image: registry: docker.io repository: ethereum/client-go tag: 'alltools-v1.13.4' fabric: ca: image: registry: docker.io repository: hyperledger/fabric-ca tag: '1.5.13' orderer: image: registry: docker.io repository: hyperledger/fabric-orderer tag: '2.5.10' tools: image: registry: docker.io ``` -------------------------------- ### Getting Help for Hasura Integration Tool Creation in SettleMint SDK CLI Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-offchain-database.mdx This command displays detailed information and available options for creating a Hasura integration tool using the SettleMint platform CLI, providing guidance on its usage. ```bash settlemint platform create integration-tool hasura --help ``` -------------------------------- ### Installing Hyperledger Fabric Chaincode Package Source: https://github.com/settlemint/docs/blob/main/content/docs/knowledge-bank/chaincode.mdx This command installs a packaged chaincode archive (`mycc.tar.gz`) onto a peer using the `peer lifecycle chaincode install` CLI. Successful installation returns a package ID, which is required for the subsequent approval step. ```Bash peer lifecycle chaincode install mycc.tar.gz ``` -------------------------------- ### Managing Platform Smart Contract Sets (CLI) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-code-studio.mdx These commands allow you to manage smart contract sets that have been deployed or created on the SettleMint platform. You can list all smart contract sets associated with a specific application or retrieve detailed information about a particular smart contract set. ```bash # List smart contract sets settlemint platform list smart-contract-sets --application # Read smart contract set details settlemint platform read smart-contract-set ``` -------------------------------- ### Initial SettleMint Platform Configuration (YAML) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This YAML snippet defines initial configuration parameters for the SettleMint platform, including storage and ingress classes, replica counts for various components (app, api, job, deployWorker, clusterManager), resource requests for jobs and workers, and image pull credentials for a Harbor registry. It also enables the Kubernetes replicator support. ```YAML storage: storageClass: "standard" ingress: ingressClass: "nginx" app: replicaCount: "2" api: replicaCount: "2" existingSecret: "example-secret" job: resources: requests: cpu: "100m" memory: "512Mi" deployWorker: resources: requests: cpu: "100m" memory: "512Mi" clusterManager: replicaCount: "2" imagePullCredentials: registries: harbor: enabled: true registry: "harbor.settlemint.com" username: "example_user" password: "abc123registry456password" email: "example@company.com" support: kubernetes-replicator: enabled: true ``` -------------------------------- ### Installing cert-manager with Helm Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/domain-and-tls.mdx This snippet demonstrates how to add the Jetstack Helm repository and install cert-manager into a Kubernetes cluster. It ensures that cert-manager's Custom Resource Definitions (CRDs) are also installed, which are necessary for managing certificates. ```bash helm repo add jetstack https://charts.jetstack.io --force-update helm repo update helm upgrade --install \ cert-manager jetstack/cert-manager \ --namespace cert-manager \ --create-namespace \ --set installCRDs=true ``` -------------------------------- ### Debugging SettleMint Helm Installation (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This Bash command initiates a debug dry run of the SettleMint Helm installation. It's used to identify potential configuration issues or errors before applying changes to the cluster, providing detailed output for troubleshooting. ```bash helm upgrade --install --debug --dry-run SettleMint oci://registry.settlemint.com/settlemint-platform/SettleMint \ --namespace SettleMint \ --values values.yaml ``` -------------------------------- ### Foundry Test Script for UserData Contract (Solidity) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/deploy-smart-contracts.mdx This Solidity test script, `UserData.t.sol`, uses Foundry's `forge-std/Test.sol` to thoroughly test the `UserData` smart contract. It includes setup for contract deployment and various test cases for creating, updating, deleting, and retrieving user profiles, as well as validating error conditions using `vm.expectRevert` for scenarios like duplicate IDs or non-existent profiles. ```Solidity // SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.24;\n\nimport "forge-std/Test.sol";\nimport "../contracts/UserData.sol"; // Adjust the import path if needed\n\ncontract UserTest is Test {\n UserData public user;\n\n function setUp() public {\n // Deploy the contract before each test\n user = new UserData();\n }\n\n function testCreateProfile() public {\n // Call createProfile\n user.createProfile(1, "Alice", "alice@email.com", 30, "USA", true);\n\n // Fetch the profile struct\n UserData.UserProfile memory profile = user.getProfile(1);\n\n // Assert values match what we set\n assertEq(profile.name, "Alice");\n assertEq(profile.email, "alice@email.com");\n assertEq(profile.age, 30);\n assertEq(profile.country, "USA");\n assertEq(profile.isKYCApproved, true);\n assertEq(profile.isDeleted, false);\n }\n\n function testUpdateProfile() public {\n // First create a profile\n user.createProfile(2, "Bob", "bob@email.com", 28, "UK", false);\n\n // Update profile with new values\n user.updateProfile(2, "Bob Updated", "bob@new.com", 29, "Canada", true);\n\n // Fetch the updated profile\n UserData.UserProfile memory profile = user.getProfile(2);\n\n // Assert updated values\n assertEq(profile.name, "Bob Updated");\n assertEq(profile.email, "bob@new.com");\n assertEq(profile.age, 29);\n assertEq(profile.country, "Canada");\n assertEq(profile.isKYCApproved, true);\n assertEq(profile.isDeleted, false);\n }\n\n function testDeleteProfile() public {\n // Create and delete a profile\n user.createProfile(3, "Charlie", "charlie@email.com", 25, "Germany", true);\n user.deleteProfile(3);\n\n // Expect revert on reading a deleted profile\n vm.expectRevert("Profile not found or has been deleted");\n user.getProfile(3);\n }\n\n function testCannotCreateDuplicateProfile() public {\n // Create the profile\n user.createProfile(4, "Dan", "dan@email.com", 35, "India", false);\n\n // Attempt to create with the same ID again should revert\n vm.expectRevert("Profile already exists");\n user.createProfile(4, "DanAgain", "dan@retry.com", 36, "India", true);\n }\n\n function testCannotUpdateNonexistentProfile() public {\n // Try to update a profile that was never created\n vm.expectRevert("Profile does not exist or has been deleted");\n user.updateProfile(5, "Eve", "eve@email.com", 31, "Brazil", true);\n }\n\n function testCannotDeleteNonexistentProfile() public {\n // Try to delete a profile that doesn't exist\n vm.expectRevert("Profile already deleted or doesn't exist");\n user.deleteProfile(6);\n }\n\n function testSoftDeletedCannotBeRead() public {\n // Create and delete a profile\n user.createProfile(7, "Zed", "zed@email.com", 44, "Japan", true);\n user.deleteProfile(7);\n\n // Trying to read it should revert\n vm.expectRevert("Profile not found or has been deleted");\n user.getProfile(7);\n }\n\n function testRecreateAfterSoftDelete() public {\n // Create and delete a profile\n user.createProfile(8, "Tom", "tom@email.com", 20, "Italy", true);\n user.deleteProfile(8);\n\n // Re-create it with new data (allowed due to soft-deletion)\n user.createProfile(8, "TomNew", "tom@new.com", 21, "Spain", false);\n\n UserData.UserProfile memory profile = user.getProfile(8);\n\n assertEq(profile.name, "TomNew");\n assertEq(profile.email, "tom@new.com");\n assertEq(profile.age, 21);\n assertEq(profile.country, "Spain");\n assertEq(profile.isKYCApproved, false);\n assertEq(profile.isDeleted, false);\n }\n} ``` -------------------------------- ### Creating Storage via SettleMint CLI Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-storage.mdx Provides commands for creating new storage instances (IPFS or MinIO) using the SettleMint CLI. It includes options to discover available storage types, create a new instance by specifying its type and a unique name, and access detailed command-specific help. ```bash # Get the list of available storage types settlemint platform create storage --help # Create storage settlemint platform create storage # Get information about the command and all available options settlemint platform create storage --help ``` -------------------------------- ### Deploying Custom Contracts and Subgraph for SettleMint Asset Tokenization Kit (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/application-kits/asset-tokenization/deployment.mdx This snippet outlines the comprehensive steps for deploying custom contracts and a subgraph for the Asset Tokenization Kit. It includes installing dependencies, authenticating with SettleMint, deploying smart contracts and the subgraph remotely, regenerating code, setting up the DApp, and finally starting the development server. Prerequisites include Forge v0.3.0 and Node.js >=20.18.1. ```bash # Install dependencies bun install # Login and connect to SettleMint bun settlemint login bun settlemint connect # Deploy contracts cd kit/contracts bun deploy:remote # Deploy subgraph cd ../subgraph bun deploy:remote cd ../../ # Codegen bun codegen # Setup dapp cd kit/dapp bun addresses bun db:push # Start development server bun dev ``` -------------------------------- ### Creating Smart Contract Set on Platform (CLI) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/evm-chains-guide/setup-code-studio.mdx This command allows you to create a new smart contract set directly on the SettleMint platform using the CLI. It requires specifying the tool name, the target application, the template to use, and the desired deployment plan. ```bash settlemint platform create smart-contract-set \ --application \ --template \ --deployment-plan ``` -------------------------------- ### Creating Storage with SettleMint CLI Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/hyperledger-fabric-guide/setup-storage.mdx These commands facilitate the creation of new storage instances using the SettleMint CLI. They provide options to discover available storage types, initiate a new storage instance by specifying its type and name, and access detailed help for the creation command. ```bash # Get the list of available storage types settlemint platform create storage --help # Create storage settlemint platform create storage # Get information about the command and all available options settlemint platform create storage --help ``` -------------------------------- ### Viewing Installed Chaincodes on a Peer (Shell) Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/hyperledger-fabric-guide/deploy-chain-code.mdx This command allows users to inspect the chaincodes that are currently installed on a specified peer node. ```Shell ./chaincode.sh installed ``` -------------------------------- ### Viewing SettleMint Platform Helm Chart Values (Bash) Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/platform-installation.mdx This command displays all available configuration options and their default values for the SettleMint Platform Helm chart, specifically version 7.0.0, from the OCI registry. This allows users to review and understand the customizable parameters before proceeding with the platform deployment. ```bash helm show values oci://registry.settlemint.com/settlemint-platform/SettleMint --version 7.0.0 ``` -------------------------------- ### Installing Self-Hosted Vault via Helm Source: https://github.com/settlemint/docs/blob/main/content/docs/launching-the-platform/self-hosted-onprem/prerequisites/secret-management.mdx This Helm command installs or upgrades the HashiCorp Vault chart from its official repository into the `vault` namespace. It ensures Vault is deployed and managed within a Kubernetes environment. ```bash helm upgrade --install vault vault \ --repo https://helm.releases.hashicorp.com \ --namespace vault \ --create-namespace ``` -------------------------------- ### Listing Applications using SettleMint SDK CLI Source: https://github.com/settlemint/docs/blob/main/content/docs/building-with-settlemint/hyperledger-fabric-guide/create-an-application.mdx This command lists all applications accessible within your SettleMint platform. It provides an overview of existing applications, requiring appropriate workspace permissions. ```bash settlemint platform list applications ```