Filecoin 백서

Filecoin

원문

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

abyte,forest,forest-token,skiff} /mnt/hdd/curio-pdp-pieces ``` {% hint style="info" %} Curio-PDP ships with its own Forest chain node. If you already run a synced Lotus or Forest node, set `FULLNODE_API_INFO` in `.env` (for example `FULLNODE_API_INFO=/ip4/host.docker.internal/tcp/1234/http` for Lotus on the same host). Inside the container, use `host.docker.internal` or a LAN IP, never `127.0.0.1`. {% endhint %} ### A4. Start the stack **Calibration:** ```sh docker compose -f docker-compose.yaml -f docker-compose.calibnet.yaml up -d ``` **Mainnet:** ```sh docker compose up -d ``` Check health and follow the logs (Ctrl-C stops following, not the containers): ```sh docker compose ps docker compose logs -f ``` On first start, Forest downloads a chain snapshot. The mainnet snapshot is large, so this can take a while. Curio-PDP starts as soon as Forest accepts RPC connections, but wallet balances and FWSS registration only work **after Forest has finished syncing**. To watch progress: ```sh docker compose logs -f forest ``` To stop the stack later, run `docker compose down`. Your data remains in the directories set in `.env`. ### A5. Open the admin GUI The admin GUI listens on `127.0.0.1:4701` on the server. **It has no login.** Anyone who can reach it can manage your keys, so never expose port 4701 to the internet. From your laptop, open an SSH tunnel to the server and browse to it locally: ```sh ssh -fN -L 4701:127.0.0.1:4701 youruser@your-server # then open http://127.0.0.1:4701 in your browser ``` ### A6. Attach piece storage In the GUI, open **Storage**: 1. Pick a suggested folder under `/data`. This is the `SKIFF_STORAGE` bulk disk from `.env`. You can also enter any existing path inside the container. 2. Select **Attach**. Paths aren't registered automatically, so you must attach at least one. Client piece data is written to the attached folders. Piece indexes stay in YugabyteDB on your fast disk. ### A7. Create and fund your PDP wallet Curio-PDP signs its on-chain PDP messages with an Ethereum-style (0x) key stored in YugabyteDB. 1. In the GUI, open **PDP** → wallet section. 2. Choose one: * **Create** generates a new key on the node. **The private key is shown only once.** Copy it into your password manager or secrets store before you close the dialog. * **Import** lets you paste the hex private key of a 0x address you already control. 3. Copy the **0x address** that the GUI displays and fund it: * **Calibration:** at least **5 tFIL** from a faucet. * **Mainnet:** about **8 FIL**. Any wallet or exchange that can send to a 0x (f410) address works. This balance pays gas for registration and for your ongoing proof messages. Keep it topped up. Curio allows only one PDP key per cluster. {% hint style="warning" %} The key lives in YugabyteDB. Back up the `YUGABYTE_DATA` directory, or use YugabyteDB's backup tooling, before you redeploy or move servers. If you lose the database without a backup, you lose the key. {% endhint %} ### A8. Turn on the public HTTPS endpoint In the GUI, open **Configurations** and edit the **`base`** layer. Curio-PDP reads only `base`, so don't create separate layers. Confirm these values: ```toml [Subsystems] EnablePDP = true EnableWebGui = true GuiAddress = "127.0.0.1:4701" # never 0.0.0.0 [HTTP] Enable = true DomainName = "pdp.example.com" DelegateTLS = false # Curio-PDP terminates TLS itself using Let's Encrypt on port 443 ``` Save, then restart Curio-PDP: ```sh docker compose restart skiff ``` From a machine **outside** your network, check that the endpoint answers over HTTPS: ```sh curl https://pdp.example.com ``` The response should be a short "Hello" message from Curio. If the check only succeeds from the server itself, see [A10. Troubleshooting](#a10-troubleshooting). ### A9. Register with the Filecoin Warm Storage Service Registration publishes your node to the on-chain FWSS service provider registry. That's how clients find you. In the GUI, open **PDP** and find the registration section (labelled **Register**, or **Filecoin Service Registry**): 1. **Register Provider.** Fill in these fields, then submit: | Field | Value | | ---------------------- | ------------------------------------------------------------------------ | | Name | Up to 128 characters | | Description | Up to 256 characters | | Location | For example `C=US;ST=California;L=San Francisco`. Only `C=` is required. | | Storage Capacity (TiB) | Your available capacity, as a whole number of TiB | The **Register Provider** button stays disabled until your PDP wallet from A7 is set up and funded. Registration also publishes a default PDP offering: pieces from 1 MiB to 64 GiB, IPNI on, and the default proving period. 2. **Update PDP Offering.** Set **Service URL** to `https://pdp.example.com` and check the location and capacity. Then use **Add Capability** to add the key `serviceStatus` with the value `prod`, and submit. Each submission is an on-chain transaction paid from your PDP wallet. You can come back and change the offering at any time. **You don't set a price.** The FWSS contract fixes the price for every provider: **2.5 USDFC per TiB per month**, plus **0.12 USDFC per data set per month**, plus a **0.5% network fee** taken at settlement. There's no price field to fill in, and the offering can't change these rates. **Registering doesn't bring client data right away.** Registration puts you in the registry. Before any client data is sent to you, the network tests your node and the working group approves you. Expect a gap between registering and your first data. Keep the node online, proving, and reachable while you wait. Optionally, confirm end-to-end reachability with `pdptool`, which ships in the Curio repo and needs Go installed: ```sh cd ~/curio/cmd/pdptool && go build . # use the path where you cloned Curio in A3 ./pdptool ping --service-url https://pdp.example.com --service-name public # Expected: Ping successful: Service is reachable and JWT token is valid. ``` **You're now a PDP service provider.** Your node syncs the chain, stores pieces on your bulk disk, answers PDP challenges, and is listed in the FWSS registry. When you're comfortable on Calibration, repeat A3–A9 on mainnet with the mainnet image, a mainnet domain, and a new mainnet data directory. ### A10. Troubleshooting | Symptom | What to check | | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | | Wallet balance shows an error | Forest is still syncing. Run `docker compose logs -f forest` and wait. | | Curio-PDP can't reach the chain node | Bundled Forest: check that the `forest` container is healthy. External node: use `host.docker.internal` or a LAN IP, not `127.0.0.1`. | | "PDP wallet not configured" alert | Complete [A7](#a7-create-and-fund-your-pdp-wallet). | | No storage paths | Complete [A6](#a6-attach-piece-storage). Check that the container can write to the folder. | | HTTPS works locally but not remotely | Check that the DNS A record points to your public IP, that ports 80 and 443 are open inbound, and that no other service holds port 443. | | Registration fails | Check that the wallet is funded, Forest is synced, and `HTTP.DomainName` matches a domain that resolves to this server. | *** ## Path B: Consensus Mining <a href="#path-b" id="path-b"></a> A consensus miner (the traditional Filecoin storage provider) commits storage to the network in **sectors**. Each sector is 32 GiB or 64 GiB of data, or empty "committed capacity," sealed with Proof of Replication. The sectors you prove give you **storage power**. Every 30-second epoch, the network elects miners in proportion to their power to produce blocks and earn **block rewards**. A PoRep-backed provider can also add Filecoin Onchain Cloud (FOC) service revenue by running a combined cluster. See [Path C](#path-c). You'll run three pieces of software: * **Lotus**, a full Filecoin chain node. It syncs the chain, holds your wallets, and sends messages. * **YugabyteDB**, the database that coordinates every Curio node in your cluster (Curio calls it HarmonyDB). * **Curio**, the storage provider software. It seals sectors, runs WindowPoSt and WinningPoSt, and runs the storage market. It replaces the older `lotus-miner`, `lotus-worker`, and Boost stack. Boost no longer works with current Curio releases. If you still run `lotus-miner` and Boost, move to Curio with **Migrate from existing Lotus-Miner** in [B8](#b8-create-your-miner). Docs for the older stack: [Boost](https://boost.filecoin.io). ### B1. Understand the economics Read this section before you buy anything. Consensus mining locks up capital, and penalties are automatic. **How you prove storage:** * **Sealing (PoRep).** Sealing encodes each sector into a unique replica. It's the compute-heavy step, and it's what your sealing hardware is for. * **WindowPoSt.** Every sector is proven once every 24 hours. The day is split into 48 deadlines of 30 minutes each. Your sectors are assigned to deadlines, and you must submit each proof on-chain within its 30-minute window. * **WinningPoSt.** When you're elected to produce a block, you must produce a short proof within seconds to claim the reward. **How you earn:** * **Block rewards.** Your odds of winning a block are proportional to your share of network power. You need **at least 10 TiB of raw power** to be eligible at all. Even above that threshold, small miners may wait a long time for their first block. 25% of each reward is available immediately; the other 75% vests over about 180 days. * **Deal fees.** Clients can pay you to store their data in your sectors. * **Quality-adjusted power.** From the Solstice network upgrade ([FIP-0118](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0118.md)), every new sector gets 10× quality-adjusted power, with or without client data, and Filecoin Plus datacap is retired. Existing sectors can be upgraded to 10×. The multiplier raises your block-reward odds and your pledge by the same factor. Until Solstice reaches mainnet, only verified deals (Filecoin Plus) get it. **What you lock up and pay:** * **Initial pledge.** FIL locked per sector for the sector's lifetime. As a rule of thumb, *pledge for X TiB ≈ (current initial pledge per 32 GiB sector) × 32 × X*. Chain explorers show the current per-sector pledge. For example, at 0.20 FIL per sector, 100 TiB needs about 640 FIL. * **Pre-commit deposit.** A smaller deposit when a sector is pre-committed. You lose it if the sector never completes sealing. * **Gas.** Paid for pre-commit, prove-commit, and WindowPoSt messages. * **Daily sector fee (FIP-0100).** Every new, extended, or updated sector pays a small daily fee based on its power. The fee comes first from your vesting rewards, then from your miner's available balance. Any shortfall becomes **fee debt**. While you have fee debt, you can't win block rewards, and some messages (such as new pre-commits) may be blocked. **What it costs you when things go wrong:** * **Fault fee.** Charged for each day a sector misses its WindowPoSt. * **Sector penalty.** Charged for a fault you didn't declare before the proof was due. * **Termination fee.** Charged when a sector ends early. * **Consensus fault slashing.** For provably malicious behavior. {% hint style="warning" %} **Plan for the startup gap.** Before your first block reward arrives, you pay pledge, gas, and daily fees out of pocket. Keep a FIL buffer in your miner actor for fees and WindowPoSt messages, and don't withdraw it all. An underfunded miner can get stuck: it can't seal new sectors, it can miss proofs, and it can't win blocks. {% endhint %} Committed capacity (CC) sectors, which are sealed with no client data, are the simplest way to start. Their profitability depends heavily on the FIL price. Most serious operators add client deals over time, either by sealing them into new sectors or by upgrading CC sectors in place with SnapDeals. ### B2. Get the hardware You can start on Calibration with everything on one large machine. A production mainnet setup splits the work across roles. Sector sizes on Calibration match mainnet, so you need real sealing hardware on Calibration too. | Role | Typical spec | Notes | | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Chain node** (Lotus) | 8+ cores, 64 GiB+ RAM, 2 TB NVMe, public IP | Must be available at all times. Run a second daemon for failover in production. | | **YugabyteDB** | 3 nodes in production (can share hosts with Curio) | A single node is fine for testing. In production, losing the database stops Curio, so run 3+ nodes, back them up, and don't use ZFS for the database disks. | | **PoSt node(s)** (Curio `post` layer) | 16 cores, 128 GiB+ RAM, 1 GPU with 10 GB+ VRAM | Runs WindowPoSt and WinningPoSt. Run at least two for redundancy. Missing a proof costs you FIL. | | **Sealing: SDR (PC1)** | 32+ cores **with SHA extensions** (AMD EPYC or recent Xeon), 1 TiB RAM, about 450 GiB NVMe scratch per parallel sector | CPU-bound. Check support with `grep -c sha_ni /proc/cpuinfo` (any non-zero result means supported). | | **Sealing: trees (PC2) and SNARK (C2)** | 32 cores, 512 GiB RAM, GPU with 24 GB+ VRAM, NVMe scratch | GPU-bound. Plan about two PC2 GPUs per PC1 node. | | **Long-term storage** | Large HDD pools (for example RAIDZ2, 12-disk vdevs) with about 20% headroom | Holds sealed (and optionally unsealed) sectors. Must be readable by your PoSt nodes. | | **Network** | 10 GbE internally, 1–10 Gbps internet if you take online deals | Deal data ingest is bandwidth-heavy. | For scale, a well-balanced 1 PiB setup seals up to about 7 TiB per day. To start without owning sealing hardware, you can buy sealing from a Sealing-as-a-Service provider. You still need the chain node, the database, PoSt nodes, and storage. ### B3. Prepare each Linux host Run the following on every host that will run Lotus or Curio (Ubuntu or Debian). ```sh sudo apt update && sudo apt upgrade -y && sudo apt install -y \ mesa-opencl-icd ocl-icd-opencl-dev gcc git jq pkg-config curl clang \ build-essential hwloc libhwloc-dev libarchive-dev wget ntp \ python-is-python3 aria2 libgmp-dev libconfig++-dev protobuf-compiler # Raise the UDP buffer (needed by Curio and Lotus networking) sudo sysctl -w net.core.rmem_max=2097152 sudo sysctl -w net.core.rmem_default=2097152 echo 'net.core.rmem_max=2097152' | sudo tee -a /etc/sysctl.conf echo 'net.core.rmem_default=2097152' | sudo tee -a /etc/sysctl.conf ``` If you'll build from source, which you must for Calibration, also install Go and Rust. Use the Go version that Curio's `go.mod` requires (1.26.8 at the time of writing): ```sh wget -c https://go.dev/dl/go1.26.8.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # choose the default install source "$HOME/.cargo/env" ``` On GPU hosts, install your NVIDIA driver and the **CUDA Toolkit 12.x or later** so that `nvcc` is on your `PATH`. Curio's Linux build uses CUDA by default. ### B4. Run the Lotus chain node Build Lotus from the latest release: ```sh git clone https://github.com/filecoin-project/lotus.git && cd lotus git checkout $(curl -s https://api.github.com/repos/filecoin-project/lotus/releases/latest | jq -r .tag_name) make clean && make GOFLAGS="-tags=calibnet" lotus # Calibration # make clean && make lotus # Mainnet sudo make install-daemon lotus --version ``` Import a recent snapshot instead of syncing from genesis, then start the daemon: ```sh aria2c -x5 -o snapshot.car.zst https://forest-archive.chainsafe.dev/latest/calibnet/ # Calibration # aria2c -x5 -o snapshot.car.zst https://forest-archive.chainsafe.dev/latest/mainnet/ # Mainnet lotus daemon --import-snapshot snapshot.car.zst --remove-existing-chain --halt-after-import nohup lotus daemon > ~/lotus.log 2>&1 & lotus sync wait # returns when the node has caught up with the chain ``` In production, run the daemon as a systemd service rather than with `nohup`. ### B5. Create and fund your wallets A miner needs an **owner** address (it controls the miner and receives withdrawals), a **worker** address (it signs routine messages), and a **sender** address (it pays for the create-miner message). The same address can fill more than one role. On the Lotus node, create two BLS wallets: ```sh lotus wallet new bls # wallet 1: owner and sender lotus wallet new bls # wallet 2: worker lotus wallet list ``` Fund each wallet. On Calibration, about 5 tFIL each from a faucet is plenty to get started. On mainnet, the owner or miner balance must eventually cover your initial pledge (see [B1](#b1-understand-the-economics)). {% hint style="danger" %} Back up your owner key offline: `lotus wallet export <owner-address> > owner.key`. Store the file in a secure location, not on the server. Whoever holds the owner key controls your miner and its funds. {% endhint %} ### B6. Run YugabyteDB For a test setup, run a single node. For production, deploy a 3-node cluster using the same steps on each host. ```sh # Raise the open-file limit first echo "$(whoami) soft nofile 1048576" | sudo tee -a /etc/security/limits.conf echo "$(whoami) hard nofile 1048576" | sudo tee -a /etc/security/limits.conf ulimit -n 1048576 wget https://software.yugabyte.com/releases/2.25.1.0/yugabyte-2.25.1.0-b381-linux-x86_64.tar.gz tar xvfz yugabyte-2.25.1.0-b381-linux-x86_64.tar.gz && cd yugabyte-2.25.1.0 ./bin/post_install.sh ./bin/yugabyted start --advertise_address 127.0.0.1 \ --master_flags rpc_bind_addresses=127.0.0.1 \ --tserver_flags rpc_bind_addresses=127.0.0.1 ./bin/yugabyted status ``` If the start fails with a locale error, run `sudo locale-gen en_US.UTF-8` and try again. The default connection values are host `127.0.0.1`, port `5433`, user `yugabyte`, password `yugabyte`, and database `yugabyte`. ### B7. Install Curio **Mainnet, Debian package (recommended):** ```sh sudo wget -O /usr/share/keyrings/curiostorage-archive-keyring.gpg https://filecoin-project.github.io/apt/KEY.gpg echo "deb [signed-by=/usr/share/keyrings/curiostorage-archive-keyring.gpg] https://filecoin-project.github.io/apt stable main" \ | sudo tee /etc/apt/sources.list.d/curiostorage.list sudo apt update sudo apt install curio-cuda # NVIDIA GPUs # sudo apt install curio-opencl # OpenCL GPUs ``` **Calibration, or building from source on any network:** ```sh git clone https://github.com/filecoin-project/curio.git && cd curio git checkout $(curl -s https://api.github.com/repos/filecoin-project/curio/releases/latest | jq -r .tag_name) export RUSTFLAGS="-C target-cpu=native -g" export FFI_BUILD_FROM_SOURCE=1 export FFI_USE_CUDA=1 FFI_USE_CUDA_SUPRASEAL=1 # NVIDIA; for OpenCL use FFI_USE_OPENCL=1 instead make clean calibnet # Calibration # make clean build # Mainnet sudo make install # installs /usr/local/bin/curio curio --version ``` Download the proving parameters on every Curio host. The download is large, so put the cache on fast disk: ```sh export FIL_PROOFS_PARAMETER_CACHE=/mnt/nvme/filecoin-proof-parameters curio fetch-params 32GiB ``` ### B8. Create your miner Run the guided setup on your first Curio node. Curio must be built for the same network as your Lotus node. A Calibration Lotus node can't be used with a mainnet Curio. ```sh export FULLNODE_API_INFO=$(lotus auth api-info --perm admin | cut -d= -f2-) curio guided-setup ``` 1. Choose **Create a new miner**. If you're moving an existing `lotus-miner`, choose **Migrate from existing Lotus-
프로젝트로 돌아가기