From 26e01cf1ef4bd19799f525efc3863213e7e32941 Mon Sep 17 00:00:00 2001 From: aoikurokawa Date: Sun, 9 Mar 2025 15:28:52 +0900 Subject: [PATCH 1/2] fix: update --- content/getting-started/hello-world-ncn.mdx | 472 ------------------ .../getting-started/hello-world-ncn/_meta.ts | 15 + .../hello-world-ncn/getting-started.mdx | 71 +++ .../hello-world-ncn/jito-restaking.mdx | 385 ++++++++++++++ .../hello-world-ncn/ncn-on-chain.mdx | 2 + 5 files changed, 473 insertions(+), 472 deletions(-) delete mode 100644 content/getting-started/hello-world-ncn.mdx create mode 100644 content/getting-started/hello-world-ncn/_meta.ts create mode 100644 content/getting-started/hello-world-ncn/getting-started.mdx create mode 100644 content/getting-started/hello-world-ncn/jito-restaking.mdx create mode 100644 content/getting-started/hello-world-ncn/ncn-on-chain.mdx diff --git a/content/getting-started/hello-world-ncn.mdx b/content/getting-started/hello-world-ncn.mdx deleted file mode 100644 index dd06012..0000000 --- a/content/getting-started/hello-world-ncn.mdx +++ /dev/null @@ -1,472 +0,0 @@ -# Hello World NCN - -This tutorial will guide you through building a Hello World NCN (Node Consensus Network) on Jito Restaking. - -## Overview - -The Hello World NCN is a simple implementation that demonstrates: - -### By Jito Restaking: - -1. Register all components - - Registering NCN - - Registering Operators who will perform work - - Registering Vault that delegate the asset to operators - -2. Opt-in all components - -3. Delegate the asset from Vault to Operator - -### NCN Program - - Admin creating messages that need to be processe by Operators - - Operators responding to these messages and submitting signed responses - - The program verifying the operator's work through on-chain validation - -## Key Components - -### Components in the NCN program - -1. Configuration - -2. Message - -3. BallotBox - -## Let's Build - -Clone the [repo](https://github.com/aoikurokawa/hello-world-ncn). - -### Prerequisites - -- [Rust] installed -- [Solana CLI] installed -- [Jito Restaking CLI] installed - -[Rust]: https://www.rust-lang.org/tools/install -[Solana CLI]: https://solana.com/docs/intro/installation -[Jito Restaking CLI]: https://github.com/jito-foundation/restaking/blob/master/cli/getting_started.md - -### Register All Components - - -### NCN - -Create NCN Admin keypair - -```bash -solana-keygen grind --starts-with ncn:1 -mkdir -p credentials/ncn -mv ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json ./credentials/ncn/ -``` - -Faucet: https://faucet.solana.com/ - - -Initialize NCN - -```bash -./jito-restaking-cli restaking ncn initialize \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -Initialized NCN!! - -zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM - - -### Operators - -Create Operators Admin Keypair - -```bash -solana-keygen grind --starts-with ope:1 -mkdir -p credentials/operator -mv opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json ./credentials/ope/ -``` - -Faucet: https://faucet.solana.com/ - -Initialize Operator - -```bash -./jito-restaking-cli restaking operator initialize 1000 \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -Initialized Operator! - -- Operator 1: 6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj -- Operator 2: DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg -- Operator 3: 9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z - -### Vault - -Create SPL token - -```bash -spl-token create-token -``` - -SPL-Token: - -5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT - -Create Vault Admin Keypair - -```bash -solana-keygen grind --starts-with vau:1 -mkdir -p credentials/vault -mv vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json ./credentials/vault/ -``` - -Faucet: https://faucet.solana.com/ - -Initialize Vault - -```bash -./jito-restaking-cli \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json \ - --rpc-url 'https://api.devnet.solana.com' - vault vault initialize '5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT' 1000 1000 1000 9 -``` - -VRT Token: 7Xe8hbtYDh1H4NeLDoG23gvcyeGnJCbmwobvbCwbsjtp -Vault: 4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA - - -### Opt-in - -#### NCN - -##### NCN | Operator - -##### Initialize NCN Operator State - -###### Operator 1 - -```bash -./jito-restaking-cli \ - restaking ncn initialize-ncn-operator-state \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -###### Operator 2 - -```bash -./jito-restaking-cli \ - restaking ncn initialize-ncn-operator-state \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - 'DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -###### Operator 3 - -```bash -./jito-restaking-cli \ - restaking ncn initialize-ncn-operator-state \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - '9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -##### Warm Up NCN Operator State - -###### Operator 1 - -```bash -./jito-restaking-cli \ - restaking ncn ncn-warmup-operator \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -###### Operator 2 - -```bash -./jito-restaking-cli \ - restaking ncn ncn-warmup-operator \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - 'DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -###### Operator 3 - -```bash -./jito-restaking-cli \ - restaking ncn ncn-warmup-operator \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - '9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -#### NCN | Vault - -Initialize - -```bash -./jito-restaking-cli \ - restaking ncn initialize-ncn-vault-ticket \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -Warm Up - -```bash -./jito-restaking-cli \ - restaking ncn warmup-ncn-vault-ticket \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json -``` - -#### Operator - -##### Operator | NCN - -Warm Up - -- Operator 1 - -```bash -./jito-restaking-cli \ - restaking operator operator-warmup-ncn \ - '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -- Operator 2 - -```bash -./jito-restaking-cli \ - restaking operator operator-warmup-ncn \ - 'DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg' \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -- Operator 3 - -```bash -./jito-restaking-cli \ - restaking operator operator-warmup-ncn \ - '9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z' \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -##### Operator | Vault - -Initialize - -- Operator 1 - -```bash -./jito-restaking-cli \ - restaking operator initialize-operator-vault-ticket \ - '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -- Operator 2 - -```bash -./jito-restaking-cli \ - restaking operator initialize-operator-vault-ticket \ - 'DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -- Operator 3 - -```bash -./jito-restaking-cli \ - restaking operator initialize-operator-vault-ticket \ - '9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - - -warmup-operator-vault-ticket - -- Operator 1 - -```bash -./jito-restaking-cli \ - restaking operator warmup-operator-vault-ticket \ - '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -- Operator 2 - -```bash -./jito-restaking-cli \ - restaking operator warmup-operator-vault-ticket \ - 'DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -- Operator 3 - -```bash -./jito-restaking-cli \ - restaking operator warmup-operator-vault-ticket \ - '9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z' \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json -``` - -#### Vault - -##### Vault | NCN - -Initialize - -```bash -./jito-restaking-cli \ - vault vault initialize-vault-ncn-ticket \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -Warm Up - -```bash -./jito-restaking-cli \ - vault vault warmup-vault-ncn-ticket \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -##### Vault | Operator - - -Create ATA - -```bash -spl-token create-account 5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT -``` - -Mint Supported Token - -```bash -spl-token mint 5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT 3000 -``` - -Mint VRT - -```bash -./jito-restaking-cli vault vault mint-vrt 4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA 3000 0 -``` - -Initialize Operator Delegation - -###### Operator 1 - -```bash -./jito-restaking-cli \ - vault vault initialize-operator-delegation \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -###### Operator 2 - -```bash -./jito-restaking-cli \ - vault vault initialize-operator-delegation \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - 'DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -###### Operator 3 - -```bash -./jito-restaking-cli \ - vault vault initialize-operator-delegation \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - '9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z' \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -Warm up - -###### Operator 1 - -```bash -./jito-restaking-cli \ - vault vault delegate-to-operator \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ - 100 \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -###### Operator 2 - -```bash -./jito-restaking-cli \ - vault vault delegate-to-operator \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - 'DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg' \ - 100 \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -###### Operator 3 - -```bash -./jito-restaking-cli \ - vault vault delegate-to-operator \ - '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ - '9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z' \ - 100 \ - --rpc-url 'https://api.devnet.solana.com' \ - --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json -``` - -### NCN On-Chain Program - diff --git a/content/getting-started/hello-world-ncn/_meta.ts b/content/getting-started/hello-world-ncn/_meta.ts new file mode 100644 index 0000000..1f98eeb --- /dev/null +++ b/content/getting-started/hello-world-ncn/_meta.ts @@ -0,0 +1,15 @@ +import type { MetaRecord } from "nextra"; + +const meta: MetaRecord = { + "getting-started": { + title: "Getting Started", + }, + "jito-restaking": { + title: "Jito Restaking", + }, + "ncn-on-chain": { + title: "NCN On-Chain", + }, +}; + +export default meta; diff --git a/content/getting-started/hello-world-ncn/getting-started.mdx b/content/getting-started/hello-world-ncn/getting-started.mdx new file mode 100644 index 0000000..4d7bd0f --- /dev/null +++ b/content/getting-started/hello-world-ncn/getting-started.mdx @@ -0,0 +1,71 @@ +# Getting started + +## Hello World NCN + +This tutorial will guide you through building a Hello World NCN (Node Consensus Network) on Jito Restaking. +This introductory example will help you understand the fundamental concepts of NCN development and how it interacts with the Jito Restaking ecosystem. + +## Overview + +The Hello World NCN is a simple implementation that demonstrates the core mechanics of how NCNs operate within the Jito Restaking framework. +This example serves as an educational foundation that illustrates both the infrastructure setup and operational flow of a basic NCN. + + +### By Jito Restaking: + +1. Register all components + + - Registering NCN in the Jito Restaking Protocol + - Registering Operators who will perform work + - Registering Vault that delegate assets to operators, establishing the economic security model + +2. Opt-in all components + + - Activating the registered components to participate in the network + - Establishing the connection between different entities in the ecosystem + +3. Delegate the asset from Vault to Operator + + - Creating the economic relationship between `Vaults` and `Operators` + - Establishing the stake that secures the network and incentivizes honest behavior + +### NCN Program: + +The NCN program demonstrates the core workflow: + + - **Admin creating messages** that need to be processe by Operators + + - Defining the work that requires consensus + - Initiating the consensus process through message broadcasting + + - **Operators responding to messages** and submitting signed responses + + - Performing the requested validation or computation work + - Cryptographically signing their responses to ensure accountability + + - **Program verifying the operator's work** through on-chain validation + + - Ensuring the correctness of operator submissions + = Providing transparent verification that can be audited by all participants + +## Let's Build + +Follow these steps to create your own Hello World NCN: + +- Clone the [repo](https://github.com/aoikurokawa/hello-world-ncn) +- Set up your development environment using the prerequisites below +- Explore the codebase to understand the implementation details +- Deploy and test your NCN using the provided scripts and documentation + + +### Prerequisites + +Before getting started, ensure you have the following tools installed: + +- [Rust] - The programming language used for NCN development +- [Solana CLI] - Command-line tools for interacting with the Solana blockchain +- [Jito Restaking CLI] - Tools specific toe the Jito Restaking Protocol + +[Rust]: https://www.rust-lang.org/tools/install +[Solana CLI]: https://solana.com/docs/intro/installation +[Jito Restaking CLI]: https://github.com/jito-foundation/restaking/blob/master/cli/getting_started.md diff --git a/content/getting-started/hello-world-ncn/jito-restaking.mdx b/content/getting-started/hello-world-ncn/jito-restaking.mdx new file mode 100644 index 0000000..3b6b731 --- /dev/null +++ b/content/getting-started/hello-world-ncn/jito-restaking.mdx @@ -0,0 +1,385 @@ +# Jito Restaking + +This guide provides a comprehensive walkthrough of setting up a Node Consensus Network (NCN) with Jito Restaking, with detailed explanations for each step. + +## Register All Components + +Before Hello World NCN can function, you need to register three main component types: the NCN itself, Operators who perform working, and Vaults that provide economic security through asset delegation. + +### NCN Registration + +The NCN (Node Consensus Network) is the core application that defines the consensus rules and coordinates the work operators. + +#### Create NCN Admin keypair + +```bash +solana-keygen grind --starts-with ncn:1 +mkdir -p credentials/ncn +mv ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json ./credentials/ncn/ +``` + +This step creates a new keypair for the NCN admin with a vannity address that starts with "ncn:1" for easier identification. +The keypair is then stored in a dedicated credentials directory. + +> [!NOTE] +> +> You'll need SOL tokens to pay for transaction fees. Use the [Solana Faucet] to get some tokens for testing. +> +> [Solana Faucet]: https://faucet.solana.com/ + + +#### Initialize NCN + +```bash +./jito-restaking-cli restaking ncn initialize \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json +``` + +This command initializes Hello World NCN on the Solana blockchain using the Jito Restaking CLI. +It creates the necessary on-chain state to represent Hello World NCN in the Jito Restaking ecosystem. + +After successful initialization, you'll receive Hello World NCN's address: + +Ex: zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM + + +### Operators Registration + +Operators are the entities that perform working and participate in the consensus process within Hello World NCN. + +#### Create Operators Admin Keypair + +```bash +solana-keygen grind --starts-with ope:1 +mkdir -p credentials/operator +mv opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json ./credentials/ope/ +``` + +Similar to the NCN keypair, this creates a vanity address starting with "opt:1" for Hello World operator admin, making it easier to identify in transaction and logs. + +> [!NOTE] +> +> Remember to fund this address with SOL using the [Solana Faucet] +> +> [Solana Faucet]: https://faucet.solana.com/ + +#### Initialize Operator + +```bash +./jito-restaking-cli restaking operator initialize 1000 \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json +``` + +This command initializes an Operator account with a capacity of 1000 OPERATOR FEE BPS. +The capacity represents the maximum amount of stake this operator can accept from vaults. +After initialization, three operator accounts are created: + +Ex: +- Operator 1: 6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj +- Operator 2: DqwU1gHAN55PJWX25Kvopkny2ENddCjWdqX68VEWPLQg +- Operator 3: 9sMvk2pvMnPusPZWuEim5dp6JPvfM5KKmLjgRV4uw61z + +### Vault Registration + +Vaults hold and delegate assets to operators, providing economic security to the network. + +#### Create SPL token + +```bash +spl-token create-token +``` + +This creates a new SPL token that will be used by Hello World vault. In a production environment, this might be an exsting token with real economic value. + +Ex SPL-Token created: 5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT + + +#### Create Vault Admin Keypair + +```bash +solana-keygen grind --starts-with vau:1 +mkdir -p credentials/vault +mv vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json ./credentials/vault/ +``` + +This creates a vanity address starting with "vau:1" for Hello World vault admin, making it easier to identify in transactions and logs. + +> [!NOTE] +> +> Remember to fund this address with SOL using the [Solana Faucet] +> +> [Solana Faucet]: https://faucet.solana.com/ + +#### Initialize Vault + +```bash +./jito-restaking-cli \ + --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json \ + --rpc-url 'https://api.devnet.solana.com' + vault vault initialize '5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT' 1000 1000 1000 9 +``` + +This command initializes a vault with the following parameters: + +- It uses SPL token (5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT) as the supported token +- Sets **DEPOSIT_FEE_BPS** of 1000 +- Sets **WITHDRAWAL_FEE_BPS** of 1000 +- Sets **REWARD_FEE_BPS** 1000 +- Sets **DECIMALS** 9 + +After initialization, the following addresses are created: + +Ex: + +VRT Token: 7Xe8hbtYDh1H4NeLDoG23gvcyeGnJCbmwobvbCwbsjtp + +Vault: 4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA + + +## Opt-in Phase + +After registering components, they need to opt into relationships with each other. +This creates the necessary connections between NCN, Operators, and Vaults. + +### NCN Opt-ins + +#### NCN to Operator Connections + +First, we need to initialize the state that connects the NCN with each Operator. + +##### Initialize NCN Operator State + +###### Operator 1 + +```bash +./jito-restaking-cli \ + restaking ncn initialize-ncn-operator-state \ + 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ + '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json +``` + +This command creates the initial state connecting your NCN with Operator 1. +The NCN admin account is used to sign this transaction, establishing a relationship between the NCN and the operator. + +Similar commands are run for Operators 2 and 3, creating connections between your NCN and all three operators. + +##### Warm Up NCN Operator State + +After initialization, the connections need to be "warmed up" or activated. + +###### Operator 1 + +```bash +./jito-restaking-cli \ + restaking ncn ncn-warmup-operator \ + 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ + '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json +``` + +This command activates the connection between the NCN and Operator 1, allowing the operator to participate in the NCN's consensus process. +The NCN admin signs this transaction. + +Similar commands are run for Operators 2 and 3, activating all three connections. + +#### NCN to Vault Connection + +The NCN also needs to establish a connection with the Vault that will be delegating assets to the Operators. + +##### Initialize NCN Vault Ticket + +```bash +./jito-restaking-cli \ + restaking ncn initialize-ncn-vault-ticket \ + 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json +``` + +This command initializes the connection between your NCN and the Vault, creating the necessary on-chain state for the relationship. +The NCN admin signs this transaction. + +##### Warm Up + +```bash +./jito-restaking-cli \ + restaking ncn warmup-ncn-vault-ticket \ + 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/ncn/ncnnteNRPccbg5mpwuJbzmBvVexHcoDWmZnLKybr8XA.json +``` + +This command activates the connection between the NCN and the Vault, allowing the Vault to delegate assets to Operators participating in this NCN. +The NCN admin signs this transaction. + +### Operator Opt-ins + +Operators also needs to establish connections with both the NCN and the Vault. + +#### Operator to NCN Connections + +##### Warm Up + +###### Operator 1 + +```bash +./jito-restaking-cli \ + restaking operator operator-warmup-ncn \ + '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ + 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json +``` + +This command activates the connection from the Operator's side, confirming that Operator 1 is willing to participate in your NCN's consensus process. +The operator admin signs this transaction. + +Similar commands are run for Operators 2 and 3, confirming all three operators' participation. + +#### Operator to Vault Connections + +Operators also need to establish connections with the Vault to receive delegated assets. + +##### Initialize Operator Vault Ticket + +###### Operator 1 + +```bash +./jito-restaking-cli \ + restaking operator initialize-operator-vault-ticket \ + '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json +``` + +This command initializes the connection between Operator 1 and the Vault, creating the necessary on-chain state for the relationship. +The operator admin signs this transaction. +Similar commands are run for Operators 2 and 3, initializing connections between all three operators and the Vault. + +##### Warm Up Operator Vault Ticket + +###### Operator 1 + +```bash +./jito-restaking-cli \ + restaking operator warmup-operator-vault-ticket \ + '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/operator/opeKDrPSPhLYFFRpsPTLU6o86f4AFcFvNMRvbdifhvq.json +``` + +This command activates the connection between Operator 1 and the Vault, allowing the operator to receive delegated assets from the Vault. +The operator admin signs this transaction. +Similar commands are run for Operators 2 and 3, activating connections between all three operators and the Vault. + +### Vault Opt-ins + +Finally, the Vault needs to establish connections with both the NCN and the Operators. + +##### Vault to NCN Connection + +###### Initialize Vault NCN Ticket + +```bash +./jito-restaking-cli \ + vault vault initialize-vault-ncn-ticket \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json +``` + +This command initializes the connection between the Vault and the NCN, creating the necessary on-chain state for the relationship. +The vault admin signs this transaction. + +###### Warm Up Vault NCN Ticket + +```bash +./jito-restaking-cli \ + vault vault warmup-vault-ncn-ticket \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + 'zSy3NQbg13YaKVNu2zh6cZ15VtQyMeQWXc1dzzxx6LM' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json +``` + +This command activates the connection between the Vault and the NCN, allowing the Vault to delegate assets to Operators participating in this NCN. +The vault admin signs this transaction. + +##### Vault to Operator Connections + +Before delegating assets, the Vault needs to prepare the token infrastructure. + +###### Create Associated Token Account (ATA) + +```bash +spl-token create-account 5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT +``` + +This creates an associated token account for your SPL token, which will be used to hold tokens before they are delegated. + +###### Mint Supported Token + +```bash +spl-token mint 5Xk7TaAWWxCTiW1TsM4JVJkxqzFwbTAG1SBMWPfwMwT 3000 +``` + +This mints 3000 tokens to your associated token account. In a production environment, you would already have these tokens from another source. + +###### Mint VRT + +```bash +./jito-restaking-cli vault vault mint-vrt 4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA 3000 0 +``` + +This command mints Vault Restaking Tokens (VRTs), which represent the tokens being delegated to the Vault. + + +###### Initialize Operator Delegation + +####### Operator 1 + +```bash +./jito-restaking-cli \ + vault vault initialize-operator-delegation \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json +``` + +This command initializes the delegation from the Vault to Operator 1, creating the necessary on-chain state for the delegation. +The vault admin signs this transaction. + +Similar commands are run for Operators 2 and 3, initializing delegations to all three operators. + +###### Delegate To Operator + +####### Operator 1 + +```bash +./jito-restaking-cli \ + vault vault delegate-to-operator \ + '4wmTjgjB4SDgh4mxUtmpYhoGqFi9ECNZmdmuEH7K99JA' \ + '6BeXz72E9yn8JgkfzjiPdsnaE8PppbdpKTGDi7H7bsZj' \ + 100 \ + --rpc-url 'https://api.devnet.solana.com' \ + --keypair ./credentials/vault/vauBPs8vKk3tdqYkTji15xvLvDrkdowFvS4F3RapmBN.json +``` + +This command actually delegates 100 tokens from the Vault to Operator 1. +This delegation provides economic security to the network and allows the operator to participate in the consensus process. +The vault admin signs this transaction. + +Similar commands are run for Operators 2 and 3, delegating 100 tokens to each operator. + + diff --git a/content/getting-started/hello-world-ncn/ncn-on-chain.mdx b/content/getting-started/hello-world-ncn/ncn-on-chain.mdx new file mode 100644 index 0000000..35a67a1 --- /dev/null +++ b/content/getting-started/hello-world-ncn/ncn-on-chain.mdx @@ -0,0 +1,2 @@ +# Hello World NCN On-Chain Program + From 3810ad4b3f83d8539e9c4fb39729b5c1d4ef7dd5 Mon Sep 17 00:00:00 2001 From: aoikurokawa Date: Sun, 9 Mar 2025 15:30:40 +0900 Subject: [PATCH 2/2] fix: update --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index a965f58..cdafde1 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,13 @@ Required environment variables: | Name | Description | Default Value | | ------------------------ | --------------------- | ----------------------- | | NEXT_PUBLIC_API_BASE_URL | Interact with backend | `http://localhost:8080` | + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. + +- Fork the project +- Create your feature branch (git checkout -b username/feature_name) +- Commit your changes (git commit -m 'Add some feature') +- Push to the branch (git push origin username/feature_name) +- Open a Pull Request