The Interfold 백서

The Interfold

원문

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

mmittee public key is on-chain. CiphertextOutputPublished The encrypted output is on-chain. Decryption starts. DecryptionshareCreated The node made its decryption share. PlaintextAggregated The decrypted result is ready to publish. PlaintextOutputPublished The result is on-chain. E3RequestComplete The node started its cleanup for the E3. When the node runs, some commands run inside the node through the local control port: ciphernode status , wallet get , net get-peer-id , config get , rev , print-env --chain <name> , noir status , and events query . See Commands that run inside a running node . For a visual view, turn on the node dashboard . Stop and restart On SIGINT or SIGTERM , the node stops its actors and writes its event log and store to disk. This shutdown has a limit of 60 seconds. Set the stop timeout of your process manager above 60 seconds. The DAppNode package and the examples on this page use 65 seconds. The node locks its data directory ( interfold.lock ) while it runs. A second node process with the same data directory does not start. After a crash, a restore, or a binary upgrade, check the stored state before you start the node. Do these steps with the node stopped: Validate the state interfold node validate The command changes no files. It ends with VALIDATION PASSED or reports FAIL lines, and it exits with a non-zero status on a failure. In Docker, run it through the image entrypoint with the same volume and configuration: docker run --rm \ -v ciphernode-data:/home/ciphernode/.local/share/interfold \ -v "$PWD/config.yaml" :/home/ciphernode/.config/interfold/config.yaml:ro \ "$CIPHERNODE_IMAGE" \ node validate --config /home/ciphernode/.config/interfold/config.yaml Repair a recoverable tail If the report shows only an uncommitted event-log tail, or a stale sortition projection, run: interfold node validate --repair The repair indexes complete uncommitted frames again, cuts a torn tail, or rebuilds the sortition projection from intact events. It never removes an indexed event. Validation checks the storage schema before it reads or repairs event logs. An unsupported schema reports the recovery instruction and skips all event and snapshot checks. Start the node Start the node only when the validation passes. ⚠️ Do not start a node when validation reports FAIL and the repair cannot fix it. Copy the data directory before you try a restore or a new sync. The repair cannot fix corruption in committed records or a storage schema that the binary does not support. When the node cannot write or flush its event log, it stops so that the process manager can restart it. Repeated storage failures are an infrastructure problem. Stop the node, keep a copy of the data, and run the validation before the next start. When a release changes the storage schema, see Upgrades . Data and backups A CLI node keeps all state in a .interfold directory next to its configuration file. The password file is in .interfold/config/<name>/ . The key store and the event log are in .interfold/data/<name>/ . Run interfold config get db_file to print the path on your host. The requirements page lists the contents. The Docker image keeps the state on its volume. See Docker state . Back up the complete .interfold directory as one unit, while the node is stopped. The event log refers to files in its event-blobs-v1 directory. Do not delete those files to free space. ⚠️ The key store holds the encrypted operator key, and the password file is next to it. A copy of the directory can sign as your operator. Encrypt backups and control access to them. Do not run two nodes from copies of the same directory. See Migrate a Node . Docker state Where the node stores its state The image entrypoint sets E3_CONFIG_DIR=/home/ciphernode/.local/share/interfold/config and E3_DATA_DIR=/home/ciphernode/.local/share/interfold/data , unless the container sets them. Thus the node keeps all of its state on the volume at /home/ciphernode/.local/share/interfold : Path on the volume Contents config/_default/key Key file with the password that encrypts the stored keys data/_default/db Key/value store: wallet key, libp2p keypair, key shares, and protocol snapshots data/_default/log.* Event logs A restart, a new container, and a new image all keep this state. docker rm does not delete a named volume. These variables override config.yaml , so the entrypoint never uses them to move state that exists. If config.yaml sets config_dir , data_dir , key_file , or db_file , the node uses that location. If a key file or database exists at /home/ciphernode/.config/interfold/.interfold , for example on a volume that is mounted at /home/ciphernode/.config/interfold , the node keeps using it. If state exists both there and on the volume, the container does not start. Keep only the state that the node last used, and start the container again. You can also set your own E3_CONFIG_DIR and E3_DATA_DIR for the container. In these cases the node does not use the entrypoint's variables, so run other interfold commands through the entrypoint, which chooses the same location. For example, run docker exec ciphernode ciphernode-entrypoint.sh wallet get --config /home/ciphernode/.config/interfold/config.yaml . The command in Validate the state also runs through the entrypoint. Move state from an earlier image Earlier images did not set these variables. A node that started from such an image, without a volume at /home/ciphernode/.config/interfold , keeps its state inside the container, in /home/ciphernode/.config/interfold/.interfold . That directory is not on the volume. When you remove or recreate that container, you lose the key file, the key/value store, and the event log. The key/value store holds the key shares of the node, and the chain cannot restore them. ⚠️ Do not remove or recreate the old container before you copy its state. docker rm , docker compose down , and docker compose up with a new image all remove the old container. The copy puts the key file and the stored keys on the volume. Run interfold node reset-data only after the copy, and only with the new image. Never use interfold nodes purge for this migration. Do this procedure one time for each node, when the node serves no active E3. An earlier image uses storage schema 7 or earlier, and v0.19.0 uses schema 8. The procedure therefore resets the state after the copy. The reset keeps the operator key and the libp2p keypair. See Reset node state . The commands use the container name ciphernode and the volume name ciphernode-data . For Docker Compose, use the names that docker ps -a and docker volume ls show. Each one-off container runs the new image through its entrypoint, with the same volume and configuration file: new_image () { docker run --rm \ -v ciphernode-data:/home/ciphernode/.local/share/interfold \ -v "$PWD/config.yaml" :/home/ciphernode/.config/interfold/config.yaml:ro \ "$CIPHERNODE_IMAGE" \ "$@" --config /home/ciphernode/.config/interfold/config.yaml } Set the image of the new release, and pull it. The helper and the later steps use this variable. export CIPHERNODE_IMAGE = 'ghcr.io/theinterfold/ciphernode:0.19.0' docker pull "$CIPHERNODE_IMAGE" Find out how the old container starts, and whether a stop removes it: docker inspect -f '{{json .Config.Entrypoint}} {{.HostConfig.AutoRemove}}' ciphernode Continue only if the output is ["interfold"] false , or one path that ends with /interfold followed by false . For all other output, do not stop the container, and contact the protocol team: ["ciphernode-entrypoint.sh"] is the entrypoint of the earlier image. At each start, it sets the password again, and interfold password set refuses a key file that exists. Such a container cannot start again after a stop. true means that the container started with --rm . A stop removes the container and the state inside it. Make sure that no E3 is active on the network. The output must be 0 . Get the Interfold address from Contracts and addresses . cast call < Interfol d > "activeE3Count()(uint256)" --rpc-url < RPC_UR L > Record the operator address and the peer ID from the old container, while it runs. If a command fails or prints no value, stop and contact the protocol team. docker exec ciphernode interfold wallet get --config /home/ciphernode/.config/interfold/config.yaml docker exec ciphernode interfold net get-peer-id --config /home/ciphernode/.config/interfold/config.yaml Make sure that the volume has no data or config directory. If the output shows either name, stop and contact the protocol team. docker run --rm \ -v ciphernode-data:/home/ciphernode/.local/share/interfold \ --entrypoint ls \ "$CIPHERNODE_IMAGE" \ -A /home/ciphernode/.local/share/interfold Stop the old container. Do not remove it. docker stop --time 65 ciphernode Copy the data and config directories from the old container to the volume. docker cp sends each directory as a tar stream, so the key file does not go to the host disk. for dir in data config; do docker cp "ciphernode:/home/ciphernode/.config/interfold/.interfold/$dir" - | docker run --rm -i \ -v ciphernode-data:/home/ciphernode/.local/share/interfold \ --entrypoint tar \ "$CIPHERNODE_IMAGE" \ -xf - -C /home/ciphernode/.local/share/interfold done Make sure that the copy is complete. The output must show key , db , and log.0 . If a name is missing, stop and contact the protocol team. docker run --rm \ -v ciphernode-data:/home/ciphernode/.local/share/interfold \ --entrypoint ls \ "$CIPHERNODE_IMAGE" \ /home/ciphernode/.local/share/interfold/config/_default \ /home/ciphernode/.local/share/interfold/data/_default Reset the state: new_image node reset-data --yes The output must end with this line. If it says No identity was present , stop and contact the protocol team. The operator key and libp2p identity were preserved. Verify with: interfold wallet get --name _default If the command refuses, use the cases in If the command refuses . Add --allow-active-e3s only in the last case. In each other case, start the old container again: started = $( date -u +%Y-%m-%dT%H:%M:%SZ ) docker start ciphernode Use docker start also for Docker Compose. docker compose up removes the old container, which holds the state that the node uses. If the container does not start, stop and contact the protocol team, and keep the copy on the volume. The log from before the stop also holds the release lines, so read only the log since the start. When it shows Ciphernode release is accepted or Acknowledging ciphernode release , remove the copy from the volume. Then do what the case tells you. docker logs --since "$started" ciphernode docker run --rm \ -v ciphernode-data:/home/ciphernode/.local/share/interfold \ --entrypoint rm \ "$CIPHERNODE_IMAGE" \ -rf /home/ciphernode/.local/share/interfold/data /home/ciphernode/.local/share/interfold/config Run these commands. The address and the peer ID must be equal to the values from step 4. If they differ, or a command fails, stop and contact the protocol team. new_image wallet get new_image net get-peer-id Validate the state. Continue only if the report shows empty store will be initialized and ends with VALIDATION PASSED — state is intact and consistent. Otherwise, do not start the new image. Keep the old container and the volume, and contact the protocol team. new_image node validate Start the new image. For docker run , rename the old container first, then use the command in Start the container : docker rename ciphernode ciphernode-old For Docker Compose, make sure that CIPHERNODE_IMAGE names the new image. Remove the entrypoint: line from the service: step 2 required the old container to start interfold directly, but the new image must start through its own entrypoint, which uses the volume. Then run docker compose up -d . This command replaces the old container. Make sure that the log shows Ciphernode release is accepted , and that this command shows the operator address from step 4: docker exec ciphernode ciphernode-entrypoint.sh wallet get --config /home/ciphernode/.config/interfold/config.yaml For docker run , remove the old container only after step 13 succeeds. Networking Open the QUIC UDP port (default 9091 ) for inbound traffic. Do not open the control port 50505 . Requirements lists all ports. When peers is empty, the node dials the DNS bootstrap address of its network profile. Mainnet uses /dnsaddr/bootstrap.interfold.network . Sepolia uses /dnsaddr/bootstrap-sepolia.interfold.network . The profile also sets a network ID that every Interfold libp2p protocol uses. A mainnet node and a Sepolia node therefore cannot join the same network, also when a peer address is wrong. To dial specific peers, list them in the configuration: node : network : mainnet peers : - '/dns4/node1.example.com/udp/9091/quic-v1' - '/ip4/192.0.2.10/udp/9091/quic-v1' You can also add a peer at start with interfold start --peer <multiaddr> . A mainnet profile refuses the Sepolia bootstrap address. A Sepolia profile replaces the mainnet bootstrap address with the Sepolia one. Run a bootstrap node A bootstrap node is a peer that other nodes dial first to find each other. Start it with interfold start --bootstrap . The node reads the events of the Interfold contract and joins the network like a full node, but it does not serve on committees, generate proofs, sign votes, or send transactions. It therefore does not need the memory of the prover, and its address needs no ETH. When it starts, it fetches the history of open E3s from its peers like a full node. If no peer can serve that history, it starts without it, so it can start when no other node is running. Its request router expects no protocol recipients and keeps no deferred protocol backlog. It needs the same setup as a full node: a configuration with the network profile and the chains, a password, and a wallet key. The wallet key sets the node address and the libp2p peer ID, so use a key that no other node uses. The key does not have to belong to a registered operator. Open its QUIC UDP port, and add its address to the peers of the other nodes, for example /dns4/bootstrap.example.com/udp/9091/quic-v1 . Give a bootstrap node a data directory of its own. On its first start, a node records its role (full or bootstrap) in its data directory. A node does not start on a data directory that a node of the other role used. Releases without bootstrap mode do not check the role, so do not start an older release on the data directory of a bootstrap node. To change the role of a node, stop the node and run interfold node reset-data , which keeps the wallet key. Deferred protocol events A full node can receive an E3 event before the actor that consumes it starts. The request router keeps these events in order for recipients declared by the installed extensions. Each E3 has a limit of 4,096 deferred entries and 1 GiB of accounted bytes. The router has a shared limit of 16,384 entries and 3 GiB. Each recipient copy counts toward both limits, including shared payload bytes. Each entry reserves its encoded bytes, nested inline storage, and 64 bytes per allocation candidate. The reservations cover strings, byte buffers, collections, their elements, and shared payload fields. Large contiguous buffers add constant allocation overhead. They have no extra charge per payload byte. Shared bytes retain no spare capacity, and deferred copies compact collections inside shared keys and threshold shares. Each entry also reserves twice its inline event size for queue capacity. These limits cover four concurrent E3s with the largest supported committee (N=19, H=14) and the secure 8192-degree preset. The slashing recipients start at committee finalization. Keyshare and public-key recipients start at local selection. Only the plaintext recipient retains the complete local DKG history until ciphertext output arrives. The late-recipient allowance is 1,536 records and 640 MiB per E3. It includes the C1–C3 witnesses, the complete request payloads retained by computation failures, C4 inputs, peer shares, and document envelopes. Four such histories use 2.5 GiB, leaving 512 MiB of margin below the shared byte limit. The 3 GiB ceiling includes allocation reservations, but it does not measure exact resident memory. In an 8 GiB memory budget, allow another 1.5 GiB for fragmentation, freed storage, and an in-flight event. The remaining 3.5 GiB covers other actors, the process baseline, and the system. The router memory regression checks this allowance with contiguous and separately allocated small payloads. These are buffer allowances, not total node memory requirements or limits on incoming-event decoding. Proof workers need a separate allowance. See Requirements for node sizing. If a limit is exceeded, the router logs Deferred delivery failed at ERROR and clears the affected recipient's deferred queue. It retains the failure record until E3 teardown or restart and stops adding events to that queue. Other E3s and live delivery continue. The affected E3 can fail at its existing deadline. Deferred queues remain in memory only, so a restart does not restore their pre-checkpoint events. Command reference The commands on this page are start , config check , password set , wallet set , node validate , and ciphernode setup . Global flags work with every command: --config <path> , --name <profile> , -v , and -q . The CLI Reference lists every command and flag. For a schema change that needs interfold node reset-data , see Upgrades . Next steps Registration & Bonding Authorize a bond owner, bond FOLD, register the operator, and buy tickets. Set up RPC Endpoints Test the log history of an endpoint and read the sync messages. Set up Node Dashboard Watch the node events and status in a local web page. Operate Upgrades Install a new release without a gap in committee work. Maintain Requirements RPC Endpoints ## /operate/rpc-endpoints Run a Ciphernode RPC Endpoints RPC Endpoint Requirements A ciphernode reads the full contract history from an Ethereum RPC endpoint before it can take part in a committee. Many setup problems come from the endpoint, not from the node. This page explains what the node asks from an endpoint, gives a one-command test, and explains the sync messages. At the end, you know whether an endpoint is usable before you start a node with it. What the node needs Requirement Value Reason Log history From the lowest configured deploy_block The first sync reads every contract event from that block. eth_getLogs range 10,000 blocks, or a smaller cap The node starts at 10,000 blocks ( rpc_log_range_blocks ) and halves the range when the provider refuses it. WebSocket A ws:// or wss:// URL After the sync, an eth_subscribe subscription announces new logs. Rate limits Short bursts are acceptable The node retries HTTP 429 and 503 responses (see below). Historical state Not needed The node replays history from logs. It does not read contract state at old blocks. An endpoint can keep old logs and not keep old state, or the opposite. A test of historical state ( eth_getCode or eth_call at an old block) therefore tells you nothing about log history. Use one provider for the subscription and for the requests of a chain. Do not put a round-robin pool of separately synced providers behind one URL. The subscription can announce a block before another member of the pool can return that block or its logs. How the first sync works Start block The lowest deploy_block of all configured contracts. Fetch logs eth_getLogs in ranges of 10,000 blocks. Narrow Halve the range when the provider refuses it
프로젝트로 돌아가기