Arcium 백서

Arcium

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 17쪽 중 11쪽

you get an error during setup saying your number is already taken, pick a different one and try again. * `--ip-address`: Your node's public IPv4 address * `--rpc-url`: Solana RPC endpoint (mainnet or devnet) If successful, you'll see confirmation that your node accounts have been initialized onchain. ## Step 6: Configure your node The configuration file specifies which network to connect to, how to communicate with other nodes, and various operational settings. Create a `node-config.toml` file in your `arcium-node-setup` directory: ```toml theme={null} [node] offset = <your-node-offset> # Your node offset from step 5 computations_limit = 10 # Max computations the node executes concurrently distributed_preprocessing = false # Optional. true runs Cerberus preprocessing instead of a trusted dealer parallel_preprocessing_bundlers = 1 # Optional. Distributed preprocessing only; must match across the cluster preprocessing_refill_threshold = 65536 # Optional. Distributed preprocessing only; buffer level in elements [solana] endpoint_rpc = "<your-rpc-provider-url-here>" # e.g., https://api.mainnet-beta.solana.com or https://api.devnet.solana.com endpoint_wss = "<your-rpc-websocket-url-here>" # Replace with your RPC provider WebSocket URL (e.g., wss://api.mainnet-beta.solana.com) secondary_endpoint_rpc = "<your-fallback-rpc-url-here>" # Failover RPC, ideally a different provider secondary_endpoint_wss = "<your-fallback-websocket-url-here>" # Failover WebSocket, ideally a different provider ``` <Note> The two `[node]` fields and all four `[solana]` fields are required. The config fails to parse if any are missing. The three preprocessing fields are optional and default to the values shown, so a `node-config.toml` written before v0.15.0 keeps working unchanged. The node fails over to the secondary endpoints when the primary RPC lags or stops responding, so point them at a different provider than your primary endpoints. </Note> <Note>**Upgrading from v0.7.0?** The `[network]` section, `cluster`, `commitment`, `hardware_claim`, `starting_epoch`, and `ending_epoch` fields have been removed. Update your `node-config.toml` to the simplified format above.</Note> ### Preprocessing backend A node consumes correlated randomness that has to be generated before computations run. Two backends produce it: | Backend | `distributed_preprocessing` | Needs a trusted dealer | | ---------------------- | --------------------------- | ---------------------- | | Trusted dealer | `false` (default) | Yes | | Distributed (Cerberus) | `true` | No | The default is the trusted dealer, so existing deployments are unaffected by the upgrade. <Warning> The config reader ignores keys it does not recognize, and `distributed_preprocessing` defaults to `false` when absent. A misspelled key is therefore dropped silently and the node runs on the trusted dealer, with no parse error to warn you. This applies to every optional key here, not just this one. The node logs the backend it resolved at startup: ``` Preprocessing backend: distributed (Cerberus), global-keys seed fingerprint <fingerprint> Preprocessing backend: trusted dealer ``` Check that line after changing this setting. The fingerprint also makes a seed that changed between restarts visible without printing the secret. </Warning> #### Distributed (Cerberus) preprocessing Set `distributed_preprocessing = true`, then point the node at the seed you generated in step 3.6 by adding the environment variable and mount to your `docker-compose.yml`: ```yaml theme={null} environment: CERBERUS_GLOBAL_KEYS_SEED_FILE: /usr/arx-node/node-keys/cerberus_seed.json volumes: - ./cerberus-seed.json:/usr/arx-node/node-keys/cerberus_seed.json:ro ``` The node refuses to start if the variable is unset, or if the file is missing, unreadable, the wrong length, or all zeroes. Two optional settings trade throughput against memory: | Setting | Default | Notes | | --------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `parallel_preprocessing_bundlers` | `1` | Independent Cerberus bundlers. Every node in a cluster **must** use the same value, or the parties' correlated streams desync. Each bundler carries its own large PCG state, so raise this only on hosts with the RAM for it. | | `preprocessing_refill_threshold` | `65536` | Buffer level each stream is topped up to while the node is idle, in elements. This is the burst absorbed at online speed before execution waits on generation. RAM scales roughly linearly with it. | A cluster on distributed preprocessing needs no trusted dealer at all: the node ignores trusted-dealer information entirely when this backend is selected. #### Trusted dealer config If you operate a trusted dealer, create a separate `trusted_dealer_config.toml` file. The trusted-dealer process reads this file; a `[dealer]` section in `node-config.toml` is ignored. The config expects every field under `[dealer]` and requires `master_seed_path`: ```toml trusted_dealer_config.toml theme={null} [dealer] private_key_path = "/usr/trusted-dealer/identity.json" master_seed_path = "/usr/trusted-dealer/master_seed.json" cluster_offsets = [456] solana_rpc_url = "<your-rpc-url>" n_peers = 4 local_ip = "0.0.0.0" rate_limit_initial_tokens = 10000000 rate_limit_tokens_per_second = 100000 rate_limit_max_tokens = 10000000 ``` Replace `456` and `4` with your cluster offset and peer count. <Warning> `local_addr` was renamed to `local_ip`. Treat `master_seed_path` as the highest-sensitivity host secret; leaking it compromises keyshares. </Warning> ## Step 7: Cluster operations Clusters are groups of nodes that collaborate on MPC computations. For background on cluster concepts, see [Clusters overview](/clusters/overview). Most operators should **join an existing cluster**. Only create your own cluster if you're coordinating a group of nodes. <Tabs> <Tab title="Join Existing Cluster"> To join an existing cluster, you must first be **proposed by the cluster authority**. Once proposed, accept the invitation: ```bash theme={null} arcium join-cluster true \ --keypair-path node-keypair.json \ --node-offset <your-node-offset> \ --cluster-offset <cluster-offset> \ --rpc-url <your-rpc-url> ``` **Parameters:** * `true`: Accept the join request (use `false` to reject) * `--node-offset`: Your node's unique identifier (chosen during node initialization) * `--cluster-offset`: The cluster's unique identifier (different from node offset - clusters and nodes have separate ID spaces) <Note>You cannot join a cluster unless the cluster owner has first proposed you using `propose-join-cluster`.</Note> </Tab> <Tab title="Create New Cluster"> If you want to create a new cluster and invite other nodes: **1. Create the Cluster** ```bash theme={null} arcium init-cluster \ --keypair-path node-keypair.json \ --offset <cluster-offset> \ --max-nodes <max-nodes> \ --rpc-url <your-rpc-url> ``` **Parameters:** * `--offset`: Unique identifier for your cluster (different from your node offset) * `--max-nodes`: Maximum number of nodes in the cluster **Optional parameters:** * `--mempool-size`: Size of the mempool (`Tiny`, `Small`, `Medium`, `Large`). Defaults to `Tiny` * `--price-per-cu`: Initial price per compute unit in micro-lamports. Defaults to 1 * `--propose-node`: Automatically propose a node to join after creation **2. Propose Nodes to Join** After creating the cluster, you must propose each node that should join. Nodes cannot join without being proposed first: ```bash theme={null} arcium propose-join-cluster \ --keypair-path node-keypair.json \ --cluster-offset <cluster-offset> \ --node-offset <node-to-propose-offset> \ --rpc-url <your-rpc-url> ``` **Parameters:** * `--cluster-offset`: Your cluster's offset * `--node-offset`: The offset of the node you're inviting <Note>You can also propose a node inline when creating the cluster using `--propose-node <node-offset>`</Note> **3. Wait for Nodes to Accept** Once proposed, each node must accept the invitation using `join-cluster true` (see Join tab). </Tab> </Tabs> ### Submit aggregated BLS key (required after cluster is full) <Note>The command will verify that all cluster slots are filled before submitting. If nodes are still pending, it will fail with an error.</Note> Once all nodes have joined the cluster, **all nodes** must aggregate and submit the combined BLS public key. This enables threshold BLS signatures for computation callbacks: ```bash theme={null} arcium submit-aggregated-bls-key \ --keypair-path node-keypair.json \ --cluster-offset <cluster-offset> \ --node-offset <your-node-offset> \ --rpc-url <your-rpc-url> ``` **Parameters:** * `--keypair-path`: Your node authority keypair (must be a node in the cluster) * `--cluster-offset`: The cluster's offset * `--node-offset`: Your node's offset within the cluster <Note>All nodes need to run this command. The CLI will automatically fetch all node BLS public keys from the cluster and aggregate them.</Note> ### Activate the cluster (cluster authority only) After all nodes have submitted the aggregated BLS key, the **cluster authority** must activate the cluster: ```bash theme={null} arcium activate-cluster \ --keypair-path <cluster-authority-keypair> \ --cluster-offset <cluster-offset> \ --rpc-url <your-rpc-url> ``` **Parameters:** * `--keypair-path`: A keypair that has authority over the cluster * `--cluster-offset`: The cluster's offset <Note>Only the cluster authority can run this command. The cluster must have all BLS keys submitted before activation will succeed.</Note> ## Step 8: Deploy your node Before running Docker, prepare your environment and verify you have all required files: ```bash theme={null} mkdir -p arx-node-logs private-shares public-inputs ls node-keypair.json callback-kp.json identity.pem bls-keypair.json x25519-keypair.json node-config.toml ``` Create a `docker-compose.yml` file in your `arcium-node-setup` directory: ```yaml theme={null} services: arx-node: image: arcium/arx-node:v0.15.0 container_name: arx-node restart: unless-stopped environment: NODE_IDENTITY_FILE: /usr/arx-node/node-keys/node_identity.pem NODE_KEYPAIR_FILE: /usr/arx-node/node-keys/node_keypair.json CALLBACK_AUTHORITY_KEYPAIR_FILE: /usr/arx-node/node-keys/callback_authority_keypair.json BLS_PRIVATE_KEY_FILE: /usr/arx-node/node-keys/bls_keypair.json X25519_PRIVATE_KEY_FILE: /usr/arx-node/node-keys/x25519_keypair.json ARX_METRICS_HOST: 0.0.0.0 ARX_METRICS_PORT: 9091 ASYNC_MPC_STREAM_WINDOW_MB: 64 ASYNC_MPC_CONN_WINDOW_MB: 512 ASYNC_MPC_CC: bbr volumes: - ./node-config.toml:/usr/arx-node/arx/node_config.toml - ./node-keypair.json:/usr/arx-node/node-keys/node_keypair.json:ro - ./callback-kp.json:/usr/arx-node/node-keys/callback_authority_keypair.json:ro - ./identity.pem:/usr/arx-node/node-keys/node_identity.pem:ro - ./bls-keypair.json:/usr/arx-node/node-keys/bls_keypair.json:ro - ./x25519-keypair.json:/usr/arx-node/node-keys/x25519_keypair.json:ro - ./arx-node-logs:/usr/arx-node/logs - ./private-shares:/usr/arx-node/private-shares - ./public-inputs:/usr/arx-node/public-inputs ports: - "8001:8001/tcp" - "8001:8001/udp" - "8002:8002/tcp" - "8002:8002/udp" - "8012:8012/tcp" - "8012:8012/udp" - "8013:8013/tcp" - "8013:8013/udp" - "9091:9091/tcp" ``` **Key configuration:** * `image: arcium/arx-node:v0.15.0`: pinned version for stability * `restart: unless-stopped`: auto-restarts on crashes or server reboot * Volume mounts with `:ro`: read-only access for keypair files * `ASYNC_MPC_STREAM_WINDOW_MB`, `ASYNC_MPC_CONN_WINDOW_MB`, `ASYNC_MPC_CC`: recommended QUIC transport tuning for MPC throughput (per-stream and per-connection flow-control windows in MB, and the `bbr` congestion controller) Start the node: ```bash theme={null} docker compose up -d docker compose ps docker compose logs -f arx-node ``` <Warning>Ensure ports 8001, 8002, 8012, and 8013 are open for TCP and UDP. Port 9091 is TCP-only for metrics. The metrics endpoint has no authentication - restrict access to trusted networks only.</Warning> <Accordion title="Alternative: docker run command"> If you prefer using `docker run` directly: ```bash theme={null} docker run -d \ --name arx-node \ -e NODE_IDENTITY_FILE=/usr/arx-node/node-keys/node_identity.pem \ -e NODE_KEYPAIR_FILE=/usr/arx-node/node-keys/node_keypair.json \ -e CALLBACK_AUTHORITY_KEYPAIR_FILE=/usr/arx-node/node-keys/callback_authority_keypair.json \ -e BLS_PRIVATE_KEY_FILE=/usr/arx-node/node-keys/bls_keypair.json \ -e X25519_PRIVATE_KEY_FILE=/usr/arx-node/node-keys/x25519_keypair.json \ -e ARX_METRICS_HOST=0.0.0.0 \ -e ARX_METRICS_PORT=9091 \ -e ASYNC_MPC_STREAM_WINDOW_MB=64 \ -e ASYNC_MPC_CONN_WINDOW_MB=512 \ -e ASYNC_MPC_CC=bbr \ -v "$(pwd)/node-config.toml:/usr/arx-node/arx/node_config.toml" \ -v "$(pwd)/node-keypair.json:/usr/arx-node/node-keys/node_keypair.json:ro" \ -v "$(pwd)/callback-kp.json:/usr/arx-node/node-keys/callback_authority_keypair.json:ro" \ -v "$(pwd)/identity.pem:/usr/arx-node/node-keys/node_identity.pem:ro" \ -v "$(pwd)/bls-keypair.json:/usr/arx-node/node-keys/bls_keypair.json:ro" \ -v "$(pwd)/x25519-keypair.json:/usr/arx-node/node-keys/x25519_keypair.json:ro" \ -v "$(pwd)/arx-node-logs:/usr/arx-node/logs" \ -v "$(pwd)/private-shares:/usr/arx-node/private-shares" \ -v "$(pwd)/public-inputs:/usr/arx-node/public-inputs" \ -p 8001:8001/tcp -p 8001:8001/udp \ -p 8002:8002/tcp -p 8002:8002/udp \ -p 8012:8012/tcp -p 8012:8012/udp \ -p 8013:8013/tcp -p 8013:8013/udp \ -p 9091:9091/tcp \ arcium/arx-node:v0.15.0 ``` </Accordion> ## Step 9: Verify node operation Check that your node is running correctly: ### Check node status ```bash theme={null} arcium arx-info <your-node-offset> --rpc-url <your-rpc-url> ``` ### Check if node is active ```bash theme={null} arcium arx-active <your-node-offset> --rpc-url <your-rpc-url> ``` ### Metrics and health The node exposes Prometheus-compatible metrics on port 9091: | Endpoint | Description | | -------------- | --------------------------- | | `GET /metrics` | Prometheus-format metrics | | `GET /health` | Health check (returns "OK") | Verify: ```bash theme={null} curl -s http://localhost:9091/metrics | grep arx_ curl -s http://localhost:9091/health ``` Scrape with [Prometheus](https://prometheus.io/) and visualize with [Grafana](https://grafana.com/): ```yaml theme={null} # prometheus.yml snippet scrape_configs: - job_name: 'arx-node' static_configs: - targets: ['localhost:9091'] ``` ### Monitor logs ```bash theme={null} docker compose logs -f arx-node ``` ### Extract internal logs If you need detailed logs for debugging: ```bash theme={null} docker cp arx-node:/usr/arx-node/logs ./node-logs ls ./node-logs/ # Shows arx_log_<datetime>_<offset>.log ``` ## RPC provider recommendations For better reliability, consider using dedicated RPC providers instead of the default public endpoints. **Recommended providers:** * [Helius](https://helius.dev) * [Triton](https://triton.one) * [QuickNode](https://quicknode.com) ## Troubleshooting <AccordionGroup> <Accordion title="Node fails with 'missing environment variable'"> These 5 environment variables are always required. Verify your `docker-compose.yml` includes: * `NODE_KEYPAIR_FILE` * `CALLBACK_AUTHORITY_KEYPAIR_FILE` * `NODE_IDENTITY_FILE` * `BLS_PRIVATE_KEY_FILE` * `X25519_PRIVATE_KEY_FILE` A sixth, `CERBERUS_GLOBAL_KEYS_SEED_FILE`, is required when `distributed_preprocessing = true`. See [Preprocessing backend](#preprocessing-backend). </Accordion> <Accordion title="Node fails with 'X25519 key invalid'"> Regenerate the X25519 keypair: ```bash theme={null} arcium generate-x25519 -o x25519-keypair.json ``` </Accordion> <Accordion title="Node Not Starting"> * Verify all 5 keypair files exist and are readable * Check that `node-config.toml` is valid TOML with all required fields * Ensure your IP address is accessible from the internet </Accordion> <Accordion title="Node can't reach peers"> 1. Verify firewall allows inbound TCP and UDP on ports 8001, 8002, 8012, 8013, plus TCP on 9091 if exposing metrics 2. Check RPC endpoint is responsive 3. Verify node is active: `arcium arx-active <your-node-offset> --rpc-url <your-rpc-url>` </Accordion> <Accordion title="Account Initialization Failed"> * Verify you have sufficient SOL for transaction fees * Check that your RPC endpoint is working * Ensure node offset is unique (try a different number) </Accordion> <Accordion title="Cannot Join Cluster"> * Verify you've been invited by the cluster authority * Check that cluster has available slots * Ensure your node is properly initialized </Accordion> <Accordion title="BLS aggregation failing"> All cluster nodes need valid BLS keys. After all nodes join: ```bash theme={null} arcium submit-aggregated-bls-key \ --keypair-path node-keypair.json \ --cluster-offset <cluster-offset> \ --node-offset <your-node-offset> \ --rpc-url <your-rpc-url> ``` </Accordion> <Accordion title="Callback authority out of funds"> Check the balance and top up your callback account: ```bash theme={null} solana balance "$(solana address -k callback-kp.json)" # On devnet: solana airdrop 2 "$(solana address -k callback-kp.json)" -u devnet # On mainnet: transfer SOL from your funded wallet ``` </Accordion> <Accordion title="Docker Issues"> * Verify Docker is running * Check file permissions on mounted volumes * Ensure ports 8001, 8002, 8012, 8013 (TCP & UDP) and 9091 (TCP) are not already in use </Accordion> </AccordionGroup> <Tip>**Need more help?** Join the [Arcium Discord](https://discord.gg/arcium) for community support, or review the [installation troubleshooting guide](/developers/installation#issues).</Tip> ## What's next? Once your node is running successfully: * **Join the community**: Connect with other Node Operators on [Discord](https://discord.gg/arcium) * **Stay updated**: Keep your Arcium tooling updated with `arcup self update && arcup update` * **Learn more**: Read the [Arcium Network overview](/getting-started/architecture-overview) or [installation guide](/developers/installation) # Solana program overview Source: https://docs.arcium.com/developers/program Invoke encrypted computations from your Solana program using CPI Before reading this, we recommend having read the [Computation lifecycle](/developers/computation-lifecycle) section, the [Arcis inputs/outputs](/developers/arcis/input-output) section, and the [Callback type generation](/developers/program/callback-type-generation) guide to understand how output types like `AddTogetherOutput` are automatically generated from encrypted instructions. ## The basics Let's say we have the following encrypted instruction and want to invoke it from our MXE. ```rust theme={null} #[encrypted] mod circuits { use arcis::*; pub struct InputValues { v1: u8, v2: u8, } #[instruction] pub fn add_together(input_ctxt: Enc<Shared, InputValues>) -> Enc<Shared, u16> { let input = input_ctxt.to_arcis(); let sum = input.v1 as u16 + input.v2 as u16; input_ctxt.owner.from_arcis(sum) } } ``` To do this, we first need to receive the encrypted parameter of type `InputValues` which contains two encrypted `u8`s, then build the computation arguments using `ArgBuilder`, and finally queue the computation for execution. Additionally, we need to define a callback instruction that will be invoked when the computation is complete. Callback instructions have a few requirements: 1. They must be defined with the `#[arcium_callback(encrypted_ix = "encrypted_ix_name")]` macro. 2. They must have exactly two arguments: `ctx: Context<...>` and an output ar
프로젝트로 돌아가기