Filecoin 백서

Filecoin

원문

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

atured implementation of the Filecoin protocol, providing storage, retrieval, and mining functionalities. It is compatible with the Lotus implementation and can interoperate with other Filecoin nodes on the network. One of the key features of Venus is its support for the Chinese language and market. Venus provides a Chinese language user interface and documentation, making it easier for Chinese users to participate in the Filecoin network. [Learn more about Venus](/provide-storage/nodes/venus) ## Implementation differences While Lotus and Venus share many similarities, they differ in their development, feature sets, focus, and community support. Depending on your needs and interests, you may prefer one implementation over the other: ### Compatibility Both Lotus and Venus are fully compatible with the Filecoin network and can interoperate with other Filecoin nodes on the network. ### Features While both implementations provide storage, retrieval, and mining functionalities, they differ in their feature sets. Lotus includes features such as a decentralized storage market, a retrieval market, and a built-in consensus mechanism, while Venus includes features such as automatic fault tolerance, intelligent storage allocation, and decentralized data distribution. ### Focus Lotus has a more global focus, while Venus has a stronger focus on the Chinese market. Venus provides a Chinese language user interface and documentation, making it easier for Chinese users to participate in the Filecoin network. ## Other implementations ### Forest ![Forest logo.](https://3376433986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxNWFG7bQkjLkl5BBGjbD%2Fuploads%2Fgit-blob-d8f352ac01f660f37d5eba2dd0eb458248fd9ea0%2Fnodes-implementations-overview-venus-forest.webp?alt=media) Forest is the Rust implementation of the Filecoin protocol with low hardware requirements (16 GiB, 4 cores), developed by ChainSafe. Forest is focused on blockchain analytics, and does not support storage, retrieval or mining. Forest is currently used for generating up-to-date snapshots and managing archival copies of the Filecoin blockchain. Currently, the Forest team is hosting the entire Filecoin archival data for the community to use. This can be downloaded for free [here](https://forest-archive.chainsafe.dev/list/). You can learn more about Forest at the [codebase on GitHub](https://github.com/ChainSafe/forest) and [documentation site](https://docs.forest.chainsafe.io/). [Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/storage-providers/nodes/implementations) # Lotus Lotus is a full-featured implementation of the Filecoin network, including the storage, retrieval, and mining functionalities. It is the reference implementation of the Filecoin protocol. ## Interact with Lotus There are many ways to interact with a Lotus node, depending on your specific needs and interests. By leveraging the powerful tools and APIs provided by Lotus, you can build custom applications, extend the functionality of the network, and contribute to the ongoing development of the Filecoin ecosystem. ### Lotus API Lotus provides a comprehensive API that allows developers to interact with the Filecoin network programmatically. The API includes methods for performing various operations such as storing and retrieving data, mining blocks, and transferring FIL tokens. You can use the API to build custom applications or integrate Filecoin functionality into your existing applications. ### Lotus CLI Lotus includes a powerful command-line interface that allows developers to interact with the Filecoin network from the terminal. You can use the CLI to perform various operations such as creating wallets, sending FIL transactions, and querying the network. The CLI is a quick and easy way to interact with the network and is particularly useful for testing and development purposes. ### Custom plugin Lotus is designed to be modular and extensible, allowing developers to create custom plugins that add new functionality to the network. You can develop plugins that provide custom storage or retrieval mechanisms, implement new consensus algorithms, or add support for new network protocols. ### Source contributions If you are interested in contributing to the development of Lotus itself, you can do so by contributing to the open-source codebase on GitHub. You can submit bug reports, suggest new features, or submit code changes to improve the functionality, security, or performance of the network. ## Hosted nodes Many hosting service provide access to Lotus nodes on the Filecoin network. Check out the [RPC section for more information](/networks-and-tools/networks/mainnet/rpcs) ## More information For more information about Lotus, including advanced configuration, check out the Lotus documentation site [lotus.filecoin.io](https://lotus.filecoin.io). [Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/storage-providers/nodes/implementations/lotus) # Venus Venus is an open-source implementation of the Filecoin network, developed by the blockchain company IPFSForce. Venus is built in Go and is designed to be fast, efficient, and scalable. Venus is a full-featured implementation of the Filecoin protocol, providing storage, retrieval, and mining functionalities. It is compatible with the Lotus implementation and can interoperate with other Filecoin nodes on the network. One of the key features of Venus is its support for the Chinese language and market. Venus provides a Chinese language user interface and documentation, making it easier for Chinese users to participate in the Filecoin network. Venus also includes several advanced features, such as automatic fault tolerance, intelligent storage allocation, and decentralized data distribution. These features are designed to improve the reliability and efficiency of the storage and retrieval processes on the Filecoin network. ## Interact with Venus Here are some of the most common ways to interact with Venus: ### Venus API Venus provides a comprehensive API that allows developers to interact with the Filecoin network programmatically. The API includes methods for performing various operations such as storing and retrieving data, mining blocks, and transferring FIL tokens. You can use the API to build custom applications or integrate Filecoin functionality into your existing applications. ### Command-line interface Venus includes a powerful command-line interface that allows developers to interact with the Filecoin network from the terminal. You can use the CLI to perform various operations such as creating wallets, sending FIL transactions, and querying the network. The CLI is a quick and easy way to interact with the network and is particularly useful for testing and development purposes. ### Contribute to source If you are interested in contributing to the development of Venus itself, you can do so by contributing to the open-source codebase on GitHub. You can submit bug reports, suggest new features, or submit code changes to improve the functionality, security, or performance of the network. ## More information For more information about Venus, including advanced configuration, see the [Venus documentation site](https://venus.filecoin.io). [Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/storage-providers/nodes/implementations/venus) # Lite-nodes This section covers what lite-nodes are, and how developers can use them to interact with the Filecoin network. ## Table of contents * [Spin up a lite-node](/provide-storage/nodes/lite-nodes/spin-up-a-lite-node) [Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/storage-providers/nodes/lite-nodes) # Spin up a lite-node Lite-nodes are a simplified node option that allows developers to perform lightweight tasks on a local node. This page covers how to spin up a lite node on your local machine. In this guide, we will use the [Lotus](/provide-storage/nodes/lotus) Filecoin implementation to install a lite-node on MacOS and Ubuntu. For other Linux distributions, check out the [Lotus documentation](https://lotus.filecoin.io/lotus/install/linux/#building-from-source). To run a lite-node on Windows, install [WSL with Ubuntu](https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview) on your system and follow the *Ubuntu* instructions below. ## Prerequisites Lite-nodes have relatively lightweight hardware requirements. Your machine should meet the following hardware requirements: 1. At least 2 GiB of RAM 2. A dual-core CPU. 3. At least 4 GiB of storage space. To build the lite-node, you’ll need some specific software. Run the following command to install the software prerequisites: {% tabs %} {% tab title="MacOS" %} 1. Ensure you have [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) installed. 2. Install the following dependencies: ```shell brew install go jq pkg-config hwloc coreutils rust ``` {% endtab %} {% tab title="Ubuntu" %} 1. Install the following dependencies: ```shell sudo apt update -y sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y ``` 2. [Install Go](https://go.dev/doc/install) and add `/usr/local/go/bin` to your `$PATH` variable: ```shell wget https://go.dev/dl/go1.21.7.linux-amd64.tar.gz sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.7.linux-amd64.tar.gz echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc ``` 3. [Install Rust](https://www.rust-lang.org/tools/install), choose the standard installation option, and source the `~/.cargo/env` config file: ```shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source "$HOME/.cargo/env" ``` {% endtab %} {% endtabs %} ## Pre-build Before we can build the Lotus binaries, we need to follow a few pre-build steps. MacOS users should select their CPU architecture from the tabs: {% tabs %} {% tab title="MacOS Intel" %} 1. Clone the repository and move into the `lotus` directory: ```shell git clone https://github.com/filecoin-project/lotus.git cd lotus/ ``` 2. Retrieve the latest Lotus release version: ```shell git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1 ``` This should output something like: ```output v1.34.1 ``` 3. Using the value returned from the previous command, checkout to the latest release branch: ```shell git checkout v1.34.1 ``` 4. Done! You can move on to the [Build](#build-the-binary) section. {% endtab %} {% tab title="MacOS ARM" %} 1. Clone the repository and move into the `lotus` directory: ```shell git clone https://github.com/filecoin-project/lotus.git cd lotus ``` 2. Retrieve the latest Lotus release version: ```shell git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1 ``` This should output something like: ```output v1.34.1 ``` 3. Using the value returned from the previous command, checkout to the latest release branch: ```shell git checkout v1.34.1 ``` 4. Create the necessary environment variables to allow Lotus to run on M1 architecture: ```bash export LIBRARY_PATH=/opt/homebrew/lib export FFI_BUILD_FROM_SOURCE=1 export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH" ``` 5. Done! You can move on to the [Build](#build-the-binary) section. {% endtab %} {% tab title="Ubuntu" %} 1. Clone the repository and move into the `lotus` directory: ```shell git clone https://github.com/filecoin-project/lotus.git cd lotus ``` 2. Retrieve the latest Lotus release version: ```shell git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1 ``` This should output something like: ```output v1.34.1 ``` 3. Using the value returned from the previous command, checkout to the latest release branch: ```shell git checkout v1.34.1 ``` 4. If your processor was released later than an AMD Zen or Intel Ice Lake CPU, enable SHA extensions by adding these two environment variables. If in doubt, ignore this command and move on to [the next section](#build-the-binary). ```shell export RUSTFLAGS="-C target-cpu=native -g" export FFI_BUILD_FROM_SOURCE=1 ``` 5. Done! You can move on to the Build section. {% endtab %} {% endtabs %} ## Build the binary The last thing we need to do to get our node setup is to build the package. The command you need to run depends on which network you want to connect to: {% tabs %} {% tab title="Mainnet" %} 1. Remove or delete any existing Lotus configuration files on your system: ```shell mv ~/.lotus ~/.lotus-backup ``` 2. Make the Lotus binaries and install them: ```shell make clean all sudo make install ``` 3. Once the installation finishes, query the Lotus version to ensure everything is installed successfully and for the correct network: ```shell lotus --version ``` This will output something like: ```plaintext lotus version 1.34.1+mainnet+git.1ff3b360b ``` {% endtab %} {% tab title="Calibration" %} 1. Remove or delete any existing Lotus configuration files on your system: ```shell mv ~/.lotus ~/.lotus-backup ``` 2. Make the Lotus binaries and install them: ```shell make clean && make calibrationnet sudo make install ``` 3. Once the installation finishes, query the Lotus version to ensure everything is installed successfully and for the correct network: ```shell lotus --version ``` This will output something like: ```plaintext lotus version 1.34.1+calibnet+git.1ff3b360b ``` {% endtab %} {% endtabs %} ## Start the node Let's start the lite-node by connecting to a remote full-node. We can use the public full-nodes from [glif.io](https://www.glif.io/en): {% tabs %} {% tab title="Mainnet" %} 1. Create an environment variable called `FULLNODE_API_INFO` and set it to the WebSockets address of the node you want to connect to. At the same time, start the Lotus daemon with the `--lite` tag: ```shell FULLNODE_API_INFO=wss://wss.node.glif.io/apigw/lotus lotus daemon --lite ``` This will output something like: ```plaintext 2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus 2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited. ... ``` 2. The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window. {% endtab %} {% tab title="Calibration" %} 1. Create an environment variable called `FULLNODE_API_INFO` and set it to the WebSockets address of the node you want to connect to. At the same time, start the Lotus daemon with the `--lite` tag: ```shell FULLNODE_API_INFO=wss://wss.calibration.node.glif.io/apigw/lotus lotus daemon --lite ``` This will output something like: ```plaintext 2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus 2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited. ... ``` 2. The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window. {% endtab %} {% endtabs %} ## Expose the API To send JSON-RPC requests to our lite-node, we need to expose the API. {% tabs %} {% tab title="Mainnet" %} 1. Open `~/.lotus/config.toml` and uncomment `ListenAddress` on line 6: ```toml [API] # Binding address for the Lotus API # # type: string # env var: LOTUS_API_LISTENADDRESS ListenAddress = "/ip4/127.0.0.1/tcp/1234/http" # type: string # env var: LOTUS_API_REMOTELISTENADDRESS # RemoteListenAddress = "" ... ``` 2. Open the terminal window where your lite-node is running and press `CTRL` + `c` to close the daemon. 3. In the same window, restart the lite-node: ```shell FULLNODE_API_INFO=wss://wss.node.glif.io/apigw/lotus lotus daemon --lite ``` This will output something like: ```plaintext 2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus 2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited ... ``` 4. The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window. {% endtab %} {% tab title="Calibration" %} 1. Open `~/.lotus/config.toml` and uncomment `ListenAddress` on line 6: ```toml [API] # Binding address for the Lotus API # # type: string # env var: LOTUS_API_LISTENADDRESS ListenAddress = "/ip4/127.0.0.1/tcp/1234/http" # type: string # env var: LOTUS_API_REMOTELISTENADDRESS # RemoteListenAddress = "" ... ``` 2. Open the terminal window where your lite-node is running and press `CTRL` + `c` to close the daemon. 3. In the same window, restart the lite-node: ```shell FULLNODE_API_INFO=wss://wss.calibration.node.glif.io/apigw/lotus lotus daemon --lite ``` This will output something like: ```plaintext 2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus 2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited. ... ``` 4. The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window. {% endtab %} {% endtabs %} The lite-node is now set up to accept local JSON-RPC requests! However, we don't have an authorization key, so we won't have access to privileged JSON-RPC methods. ## Create a key To access privileged JSON-RPC methods, like creating a new wallet, we need to supply an authentication key with our Curl requests. 1. Create a new admin token and set the result to a new `LOTUS_ADMIN_KEY` environment variable: ```shell lotus auth create-token --perm "admin" ``` This will output something like: ```plaintext eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.um-LqY7g-SDOsMheDRbQ9JIaFzus_Pan0J88VQ6ZLVE ``` 2. Keep this key handy. We're going to use it in the next section. ## Send requests Let's run a couple of commands to see if the JSON-RPC API is set up correctly. 1. First, let's grab the head of the Filecoin network chain: ```shell curl -X POST '127.0.0.1:1234/rpc/v0' \ -H 'Content-Type: application/json' \ --data '{"jsonrpc":"2.0","id":1,"method":"Filecoin.ChainHead","params":[]}' \ | jq ``` This will output something like: ```plaintext { "jsonrpc": "2.0", "result": { "Cids": [ { "/": "bafy2bzacead2v2y6yob7rkm4y4snthibuamzy5a5iuzlwvy7rynemtkdywfuo" }, { "/": "bafy2bzaced4zahevivrcdoefqlh2j45sevfh5g3zsw6whpqxqjig6dxxf3ip6" }, ... ``` 2. Next, let's try to create a new wallet. Since this is a privileged method, we need to supply our auth key `eyJhbGc...`: ```shell curl -X POST '127.0.0.1:1234/rpc/v0' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.um-LqY7g-SDOsMheDRbQ9JIaFzus_Pan0J88VQ6ZLVE' \ --data '{"jsonrpc":"2.0","id":1,"method":"Filecoin.WalletNew","params":["secp256k1"]}' \ | jq ``` This will output something like: ```plaintext { "id": 1, "jsonrpc": "2.0", "result": "f1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa" } ``` The result field is the public key for our address. The private key is stored within our lite-node. 3. Set the new address as the default wallet for our lite-node. Remember to replace the Bearer token with our auth key `eyJhbGc...` and the `"params"` value with the wallet addre
프로젝트로 돌아가기