[
  {
    "path": "CMD.md",
    "content": "```\n深圳\n/dns4/bootstrap1.testnet.filfox.info/tcp/16666/p2p/12D3KooW9uSxsSh3qwAPxSwwRDVqTTPg8HTBthujVYFXy7Dizb6Q\n上海\n/dns4/bootstrap2.testnet.filfox.info/tcp/16666/p2p/12D3KooWKths1fzziHsmeMdTdV7dgB9DzoeiGVSwcW2HCygztH9e\n```\n\n```\n# In lotusminer/config.toml\nParallelFetchLimit = xxx\n# In lotus-worker\nlotus-worker run --parallel-fetch-limit xxx\n```\n\nhttps://lotu.sh/en+mining#separate-address-for-windowpost-messages-439130\n\n```\ncurl -X POST \\\n     -H \"Content-Type: application/json\" \\\n     -H \"Authorization: Bearer $(cat $LOTUS_PATH/token)\" \\\n     --data '{ \"jsonrpc\": \"2.0\", \"method\": \"Filecoin.MpoolGetConfig\", \"params\": [], \"id\": 3}' \\\n     http://$(cat $LOTUS_PATH/api | awk -F\\/ '{printf \"%s:%s\", $3, $5}')/rpc/v0 | jq\n\ncurl -X POST \\\n     -H \"Content-Type: application/json\" \\\n     -H \"Authorization: Bearer $(cat $LOTUS_PATH/token)\" \\\n     --data '{ \"jsonrpc\": \"2.0\", \"method\": \"Filecoin.MpoolSetConfig\", \"params\": [{\"PriorityAddrs\":[\"t3xxxxxxxxxxxxxxxxxxxxx\"],\"SizeLimitHigh\":30000,\"SizeLimitLow\":20000,\"ReplaceByFeeRatio\":1.25,\"PruneCooldown\":60000000000,\"GasLimitOverestimation\":1.25}], \"id\": 3}' \\\n     http://$(cat $LOTUS_PATH/api | awk -F\\/ '{printf \"%s:%s\", $3, $5}')/rpc/v0\n\ncurl -X POST \\\n     -H \"Content-Type: application/json\" \\\n     -H \"Authorization: Bearer $(cat $LOTUS_PATH/token)\" \\\n     --data '{ \"jsonrpc\": \"2.0\", \"method\": \"Filecoin.MpoolSelect\", \"params\": [[], 1.0], \"id\": 3}' \\\n     http://$(cat $LOTUS_PATH/api | awk -F\\/ '{printf \"%s:%s\", $3, $5}')/rpc/v0 | jq\n```\n\n```\n# In lotusminer/config.toml\nMaxWindowPoStGasFee = \"xxx FIL\"\n```"
  },
  {
    "path": "COMMIT.md",
    "content": "# 分离ProveCommitSector地址\n## 背景\n在封装过程中，如果不能一直保持worker balance充足，则有可能出现部分扇区成功发送PreCommitSector消息但没有足够币发送ProveCommitSector消息的情况。这样会造成扇区无法完成上链，抵押币和gas fee浪费。\n\n为了解决这个问题，我们可以分离发送PreCommitSector消息和发送ProveCommitSector消息的地址，并在后者充入足够的币。从而保证前者余额消耗完的时候，后者还能有余额。\n\n## 步骤\n```shell\n# 新建地址\nlotus wallet new bls\n# 向新地址打一点币\nlotus send <new address> 0.01\n# 获取当前的control地址列表\nlotus-miner actor control list --verbose\n# 更新control地址列表，加入新的地址，地址间空格分隔\nlotus-miner actor control set --really-do-it [old + new control addresses]\n# 编辑miner的config.toml，设置Address分类下的CommitControl项\n[Addresses]\n  CommitControl = [\"<new control address>\"]\n# 重启miner，查看最终control地址列表，显示如下例子\nlotus-miner actor control list --verbose\n\nname       ID      key    use     balance                     \nowner      f0...  f3...  other   123.456 FIL  \nworker     f0...  f3...  other   234.567 FIL  \ncontrol-0  f0...  f3...  commit  345.678 FIL    \ncontrol-1  f0...  f3...  post    456.789 FIL \n```\n"
  },
  {
    "path": "README.md",
    "content": "# 公告\n团队目前专注于区块链技术研究，无法继续提供软件支持。所以本软件不再更新，请使用官方版本进行代替。本软件可以和官方版本实现无缝兼容。\n\n可以关注我的[Twitter](https://twitter.com/biquanlibai)、[YouTube](https://www.youtube.com/c/biquanlibai)和[Github](https://github.com/biquanlibai)了解后续的研究方向。\n\n# lotus-miner\n[English](README_en.md)\n\n石榴矿池lotus-miner社区版，持续免费向公众提供。\n\n最新版部署文档，见 [lotus-script](https://github.com/6block/lotus-script)。\n\n# 推荐配置\n* CPU：AMD 3960X 或 Ryzen Threadripper 其他型号\n* 内存：256 GB\n* SSD：2 TB * 2\n* GPU：NVIDIA 2080 Ti\n* 操作系统：Ubuntu 18.04\n\n# 特点\n* 首次启动之后，以后所有操作自动化，无需人工干预。\n* 优化了存储和检索订单。\n* 优化了区块链同步。\n* 封装操作完全在worker完成，除了最终sealed sector（约33 GB）回传miner之外没有网络传输。\n* 自动发现空闲worker，启动封装操作。\n* 程序退出后，再次启动都能恢复运行。如果出现不能恢复的情况，可以提issue。\n* 基于推荐配置，可以进行单机3-4个sector的并行运行，每日产出存力200 GB以上。\n\n# 注意\n* 开始之前请确保有足够的空闲内存。\n* 请确保所有设备能够正常连接互联网。\n\n# 安装配置\n将会安装挖矿程序、必要的库、时间校准、显卡驱动、ulimit、swap内存（64 GB）。\n```\n# 下载\ngit clone https://github.com/shannon-6block/lotus-miner.git\ncd lotus-miner\n\n# 切换至root账户\nsudo su\n# 执行安装\n./script/install.sh\n# 安装完后可以exit回到之前的账户\n# 如果是首次安装显卡驱动，需要重启以生效\n```\n\n# 首次启动\n几个可以配置的环境变量，根据自己需求设置。\n```\n# lotus、miner、worker、零知识证明参数的目录。建议设置为SSD上的目录\nexport LOTUS_PATH=\"$HOME/.lotus\"\nexport LOTUS_MINER_PATH=\"$HOME/.lotusminer\"\nexport LOTUS_WORKER_PATH=\"$HOME/.lotusworker\"\nexport FIL_PROOFS_PARAMETER_CACHE=\"$HOME/filecoin-proof-parameters\"\n\n# 设置国内的零知识证明参数下载源\nexport IPFS_GATEWAY=\"https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/\"\n# 手动下载零知识证明参数到FIL_PROOFS_PARAMETER_CACHE目录中，有200GB\nlotus fetch-params 32GiB\n\n# 支持新的显卡\nexport BELLMAN_CUSTOM_GPU=\"GeForce RTX 3090:10496, GeForce RTX 3080:8704\"\n```\n\n启动lotus。\n```\n# 确定版本\nlotus -v\nlotus version 1.12.0+mainnet+git.9c1a8f0de.1635126034+2\n\n# 启动lotus\nnohup lotus daemon > ~/lotus.log 2>&1 &\n\n# 查看日志\ntail -f ~/lotus.log\n\n# 生成address\nlotus wallet new bls\n\n# 等待节点同步完成\nlotus sync wait\n```\n\n给生成的address发送一点FIL。\n\n启动miner。\n```\n# 查看生成address的余额\nlotus wallet balance\n\n# 使用address注册矿工\nlotus-miner init --owner=xxx --sector-size=32GiB\n\n# 如果miner和worker不在一台机器，需要在LOTUS_MINER_PATH中配置miner的IP\n# 取消ListenAddress和RemoteListenAddress前面的注释，并将它们的IP改成局域网IP\nvi ~/.lotusminer/config.toml\n\n# 启动miner。\nnohup lotus-miner run > ~/miner.log 2>&1 &\n\n# 查看日志\ntail -f ~/miner.log\n\n# storage attach，即告诉miner真正存储数据的地方。请选择机械硬盘或网盘下不存在的新目录。\nlotus-miner storage attach /path/to/storage\n\n# 查看miner信息\nlotus-miner info\n```\n\n启动worker。\n```\n# 如果miner和worker不在一台机器，需要将miner机器LOTUS_MINER_PATH下的api和token两个文件拷贝到worker机器的LOTUS_MINER_PATH下\n\n# 可选的环境变量\n# 以下设置会让PreCommit1使用更多的内存并且计算更快，在推荐的硬件配置上建议使用\n# 需要给miner和worker都设置\nexport FIL_PROOFS_SDR_PARENTS_CACHE_SIZE=1073741824\n# 以下设置会让worker使用GPU计算PreCommit2。\nexport FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1\nexport FIL_PROOFS_USE_GPU_TREE_BUILDER=1\n# 以下设置将会让worker显示更详细的日志\nexport RUST_BACKTRACE=full\nexport RUST_LOG=debug\n\n# 启动worker，需要加入局域网IP\nlotus-worker run --listen xxx.xxx.xxx.xxx:3456 > ~/worker.log 2>&1 &\n# 查看日志\ntail -f ~/miner.log\n```\n\n进阶：控制并发。\n我们可以通过以下方式让worker同时处理多个sector。\n虽然最终的计算并行度仍然取决于worker的内存，但增加并发可以让worker在部分sector处于WaitSeed的时候计算资源不闲置。\n```\n# worker使用多个封装路径，并发数也会随之增加。(这种方式只针对多块SSD没有做raid的情况)\nlotus-worker run --listen xxx.xxx.xxx.xxx:3456 --attach /path/to/another/ssd/directory\n\n# 在miner上设置ParallelSealLimit，表示每个封装路径所允许的并发数。\nvi ~/.lotusminer/config.toml\n\n# 在推荐的硬件配置上，推荐的总并发数是6。\n# 如果在miner上设置ParallelSealLimit为p，在worker上attach了n个封装路径，由于worker启动就带一个LOTUS_WORKER_PATH作为封装路径，所以该worker的总并发数为 p * ( n + 1 )。\n# 设置并发数时需要考虑封装路径所在SSD的大小，因为每个sector会消耗520GB的空间，所以每个封装路径所在SSD的大小应不小于 520GB * p。\n```\n\n进阶：将封装后的sector文件存至共享目录。\n如果miner所attach的存储路径也能在worker上以同样的路径访问到，则worker可以在FinalizeSector阶段直接将sector文件传至共享目录，而不必传回给miner。\n```\n# 设置FetchToShared = true\nvi ~/.lotusminer/config.toml\n```\n\n进阶：WindowPoSt账户分离，避免MessagePool堵塞时WindowPoSt无法上链导致的掉算力问题\n```\n# 新增一个账户用于WindowPoSt\n$ lotus wallet new bls\nt3defg...\n\n# 然后往新地址里打100FIL用于做WindowPoSt\n$ lotus send --from <address> t3defg... 100\n\n# 把这个地址设置成发WindowPoSt消息的地址\n$ lotus-miner actor control set --really-do-it t3defg...\nAdd t3defg...\nMessage CID: bafy2..\n\n# 等待消息上链\n$ lotus state wait-msg bafy2..\n...\nExit Code: 0\n...\n\n# 检查矿工控制地址列表以确保正确添加了地址\n$ lotus-miner actor control list\nname       ID      key           use    balance\nowner      t01111  t3abcd...  other  300 FIL\nworker     t01111  t3abcd...  other  300 FIL\ncontrol-0  t02222  t3defg...  post   100 FIL\n```\n\n进阶：设置ulimit，以lotus-miner为例\n```\n# 获取lotus-miner的PID(如下所示，PID为2333)\n$ ps -ef | grep lotus-miner\nroot       2333 6666 88 Nov31 ?        1-02:50:00 lotus-miner run\n# 为lotus-miner设置ulimit\nsudo prlimit --nofile=1048576 --nproc=unlimited --stack=1048576 --rtprio=99 --nice=-19 --pid 2333\n```\n\n进阶：[lotus节点导入快照快速同步](https://docs.filecoin.io/get-started/lotus/chain/)\n\n进阶：余额不足情况下不再自动添加新的封装任务（已经开始封装的会继续完成）\n```\n# 设置余额不足10 FIL情况下不再自动添加新的封装任务（默认 10000 FIL）\nlotus-miner run --min-worker-balance-for-auto-pledge 10\n```\n\n进阶：对于FatalError状态的sector，可以用下面的脚本解决\n```\nm=`lotus-miner info | grep 'Miner:' | awk -F ' ' '{print $2}'`\nlotus state sectors $m > /tmp/s.txt\nfor i in `lotus-miner sectors list | grep -P '(Fatal|Fail|Recover)' | grep -v Remove | awk -F ' ' '{print $1}'`\ndo\n  a=`cat /tmp/s.txt | grep -P \"^$i:\" | wc -l`\n  if [ $a -eq 0 ]\n  then\n    echo $i $a Removing\n    lotus-miner sectors update-state --really-do-it $i Removing\n  else\n    echo $i $a Proving\n    lotus-miner sectors update-state --really-do-it $i Proving\n  fi\ndone\n```\n\n进阶：公网ip端口绑定，假设公网ip为183.38.3.106，并将公网端口50666映射到了本地端口50888，修改lotus的config.toml，将Libp2p下的ListenAddresses和AnnounceAddresses配置如下\n```\nListenAddresses = [\"/ip4/0.0.0.0/tcp/50888\"]\nAnnounceAddresses = [\"/ip4/183.38.3.106/tcp/50666\", \"/ip4/127.0.0.1/tcp/50888\"]\n\n# 重启后检查是否生效 \n$ lotus net reachability\nAutoNAT status:  Public\n```\n\n进阶：优先打包，优先打包有两种方式。\n1. 参考脚本：https://github.com/shannon-6block/lotus-miner/blob/master/CMD.md\n2. `lotus mpool config`命令,下面的命令将PriorityAddrs的参数换成你要优先打包消息的地址，其他参数按需求设置，`lotus mpool config`可以查看当前配置\n```\n// 设置\nlotus mpool config '{\"PriorityAddrs\":[\"f3sgj7dj6caowoyulkq6xqveiogd4mqvpw7rzfpohreolwmvzutpmj6my5wl5xt5gjtq7lw5hk62rary453sga\"],\"SizeLimitHigh\":30000,\"SizeLimitLow\":20000,\"ReplaceByFeeRatio\":1.25,\"PruneCooldown\":60000000000,\"GasLimitOverestimation\":1.25}'\n```\n\n可以通过以下命令查看本地消息池拥堵情况：\n```\nlotus mpool pending --local\n```\n进阶：修改owner、worker、control地址\n```\n# 查看矿工关联的地址信息\nlotus-miner actor control list\n\n# 修改owner地址\n# step1:\nlotus-miner actor set-owner --really-do-it <newOwner> <oldOwner>\n# step2:\nlotus-miner actor set-owner --really-do-it <newOwner> <newOwner>\n\n# 修改control地址\nlotus-miner actor control set --really-do-it <address1 address2 ...>\n\n# 修改worker地址\n# step1.\nlotus-miner actor propose-change-worker <address>\n# step2.\nlotus-miner actor confirm-change-worker <address>\n```\n\n进阶：[分离ProveCommitSector地址](./COMMIT.md)\n\n进阶：限制baseFee低于阈值的时候才提交PreCommit消息，详细解释见[mainnet.1.4.0.6](https://github.com/shannon-6block/lotus-miner/releases/tag/mainnet.1.4.0.6)\n```\n# 通过miner的config.toml修改\n[Fees]\n...\nMaxBaseFee = \"3000000000 attoFIL\"\n\n# 通过命令在miner运行中修改（重启miner仍然会使用config.toml中的值）\nlotus-miner sealing set --base-fee-threshold \"3000000000 attoFIL\"\n```\n\n进阶：剩余存储空间（所有CanStore的存储路径）不足情况下不再自动添加新的封装任务\n```\n# 设置剩余存储空间不足15%情况下不再自动添加新的封装任务（默认 10%）\nlotus-miner run --min-storage-available-percent-for-auto-pledge 15\n```\n\n观察运行情况。在miner机器执行。常用命令列举如下。\n```\nlotus-miner info\nlotus-miner storage list\nlotus-miner sectors list\nlotus-miner sealing workers\nlotus-miner sealing jobs\n```\n\n或者使用区块浏览器，例如 [Filfox](https://filfox.info/) ，查看。\n\n如果sector出错，可以查看sector日志，找到出错原因。或者直接删除sector。以0号sector为例。\n```\nlotus-miner sectors status --log 0\nlotus-miner sectors update-state --really-do-it 0 Removing\n```\n\n# TODO\n* 当sector出现意料之外的错误，会进入如下两种状态。\n    * FatalError。通常由于sector的链上信息不符合预期，此时需要手动排查问题。\n    * Removing/RemoveFailed/Removed。当垃圾sector出现预料之外的错误，我们选择直接删除。\n* 程序在推荐配置下顺利运行，没有做过其他环境的测试，如果遇到问题可以提issue。\n* 会及时合入官方的代码改动。\n* 运行前请保证可用内存和SSD空间充裕。\n"
  },
  {
    "path": "README_en.md",
    "content": "# lotus-miner\n6block lotus-miner community version, which is continuously freely available to the public.\n\n# Recommended\n* CPU：AMD 3960X or other models of Ryzen Threadripper\n* RAM：256 GB\n* SSD：2 TB * 2\n* GPU：NVIDIA 2080 Ti\n* OS：Ubuntu 18.04\n\n# Features\n* After the first start-up, all subsequent operations are automate without any manual intervention.\n* Improved storage and retrieve deals.\n* Improved the sync of blockchain.\n* The sealing operation is completely completed by the worker. There is no network transmission except the final sealed sector (about 33 GB) back to the miner.\n* Automatically find idle workers and start sealing operation.\n* After the program exits, it can be resumed when it is started again. If there is an exception, please raise an issue.\n* Based on the recommended configuration, it is possible to run 3-4 sectors in a single machine in parallel, with a daily output of more than 200 GB.\n\n# Notice\n* Make sure there is enough spare RAM before you get started.\n* Make sure all your hardware can connect to the Internet.\n\n# Installation\nThe mining program, necessary libraries, time calibration , GPU driver, swap memory (64 GB) will be installed.\n```\n# Download\ngit clone https://github.com/shannon-6block/lotus-miner.git\ncd lotus-miner\n\n# Switch to root account\nsudo su\n# Execute installation\n./script/install.sh\n# After installation, you can exit and return to the previous account\n# If it is the first time installing the GPU driver, reboot is needed to take effect\n```\n\n# Setup\nSeveral configurable environment variables can be set according to your needs.\n```\n# The directory of lotus, miner, worker, and zero-knowledge proof parameters. It is recommended to set them to directories on SSD.\nexport LOTUS_PATH=\"$HOME/.lotus\"\nexport LOTUS_MINER_PATH=\"$HOME/.lotusminer\"\nexport LOTUS_WORKER_PATH=\"$HOME/.lotusworker\"\nexport FIL_PROOFS_PARAMETER_CACHE=\"$HOME/filecoin-proof-parameters\"\n\n# Set Chinese zero-knowledge proof parameter download source.\nexport IPFS_GATEWAY=\"https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/\"\n# Manually download the zero-knowledge proof parameters to the FIL_PROOFS_PARAMETER_CACHE directory, 200GB\nlotus fetch-params 32GiB\n\n# Support new graphics cards\nexport BELLMAN_CUSTOM_GPU=\"GeForce RTX 3090:10496, GeForce RTX 3080:8704\"\n```\n\nStart lotus.\n```\n# Check the version\nlotus -v\nlotus version 1.12.0+mainnet+git.9c1a8f0de.1635126034+2\n\n# Start lotus\nnohup lotus daemon > ~/lotus.log 2>&1 &\n\n# View logs\ntail -f ~/lotus.log\n\n# Generate an address\nlotus wallet new bls\n\n# Wait for node synchronized\nlotus sync wait\n```\n\nSend some FILs to the generated address.\n\nStart miner. Need to complete the test coin getting, miner registering, and node synchronization before.\n```\n# check the balance of the genetated address\nlotus wallet balance\n\n# Use miner registration results to initialize miner\nlotus-miner init --owner=xxx --sector-size=32GiB\n\n# If miner and worker are not on the same machine, you need to configure the miner's IP in LOTUS_STORAGE_PATH\n# Cancel the comment in front of ListenAddress and RemoteListenAddress and change their IPs to LAN IPs\nvi ~/.lotusstorage/config.toml\n\n# Start miner.\n# See an explanation of --max-parallel at the end\nnohup lotus-miner run > ~/miner.log 2>&1 &\n\n# View logs\ntail -f ~/miner.log\n\n# storage attach, which tells the miner where to store the data actually. Please choose a non-existing new directory under a hard disk or a network disk\nlotus-miner storage attach /path/to/storage\n\n# View miner information\nlotus-miner info\n```\n\nStart worker.\n```\n# If miner and worker are not on the same machine, you need to copy the files of api and token under LOTUS_STORAGE_PATH of miner to LOTUS_STORAGE_PATH of worker\n\n# Optional environment variables\n# The following setting will allow PreCommit1 to use more RAM and have a higher speed, which we suggest to set on the recommended hardware.\n# You need to set it both for miner and worker\nexport FIL_PROOFS_SDR_PARENTS_CACHE_SIZE=1073741824\n# The following settings will allow the worker to use the GPU to compute PreCommit2.\nexport FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1\nexport FIL_PROOFS_USE_GPU_TREE_BUILDER=1\n# The following settings will allow the worker to show more detailed logs.\nexport RUST_BACKTRACE=full\nexport RUST_LOG=debug\n\n# Start worker, need to add LAN IP\nlotus-worker run --listen xxx.xxx.xxx.xxx:3456 > ~/worker.log 2>&1 &\n# View logs\ntail -f ~/miner.log\n```\n\nAdvanced: control concurrency.\nWe can allow the worker to deal with multiple sectors at the same time by the following.\nAlthough the final computational parallelism still depends on the worker's RAM, increasing concurrency can make the worker's computational resources not idle when some sectors are in WaitSeed.\n```\n# worker uses multiple sealing paths, which will increase concurrency.\nlotus-worker run --address xxx.xxx.xxx.xxx:3456 --attach /path/to/another/ssd/directory\n\n# set ParallelSealLimit on the miner, which stands for the number of sectors allowed for each sealing storage\nvi ~/.lotusminer/config.toml\n\n# on the recommended hardware, the recommended concurrency is in total 6.\n# If you set ParallelSealLimit to p on the miner and attached n sealing paths on the worker, since the worker starts with a WORKER_PATH as sealing path, the concurrency of the worker is in total p * (n + 1 ).\n# When setting the concurrency, you need to consider the size of the SSD where the sealing path is located. Because each sector consumes 520GB of space, the size of the SSD where each sealing path is located should not be less than 520GB * p.\n```\n\nAdvanced: fetch final sector files to shared directories.\nIf the storage path attached to the miner can also be accessed through the same path on the worker, the worker can directly transfer the sector file to the shared directory during the FinalizeSector phase, instead of transferring it back to the miner.\n```\n# set FetchToShared = true\nvi ~/.lotusminer/config.toml\n```\n\nAdvanced: not to auto pledge new sectors when the balance is insufficient (sectors that have already started will continue sealing).\n```\n# not to auto pledge new sectors when the balance is less than 10 FIL (default 10000 FIL)\nlotus-miner run --min-worker-balance-for-auto-pledge 10\n```\n\nObserve the operation. Executed on the miner machine. commonly used commands are listed as follows.\n```\nlotus-miner info\nlotus-miner storage list\nlotus-miner sectors list\nlotus-miner sealing workers\nlotus-miner sealing jobs\n```\n\nOr you can use the block explorer, like [Filfox](https://filfox.info/) , to check it.\n\nIf any sector has error, you can check out the sector log for the reason of the error. Or simply remove the sector. Take sector 0 as an example.\n```\nlotus-miner sectors status --log 0\nlotus-miner sectors update-state --really-do-it 0 Removing\n```\n\n# TODO\n* When the sector has some unexpected errors, it will get into the following states\n    * FatalError. It happens when the sector information on the blockchain is unexpected, in which case a manual trouble-shooting is needed.\n    * Removing/RemoveFailed/Removed. When a garbage sector has unexpected errors, we choose to remove it directly.\n* The program runs smoothly under the recommended configuration, and has not been tested in other environments. If you encounter problems, please raise an issue.\n* The official code changes will be merged in time.\n* Before running, please ensure that available memory and SSD spaces are sufficient.\n"
  },
  {
    "path": "script/install.sh",
    "content": "#!/bin/bash\n\nrm -rf lotus-miner.tar.gz cmd\nwget https://github.com/shannon-6block/lotus-miner/releases/download/mainnet.1.12.0.0/lotus-miner.tar.gz\nmkdir cmd\ntar zxvf lotus-miner.tar.gz -C cmd/\ncp cmd/* /usr/local/bin/\n\napt update\napt install -y mesa-opencl-icd ocl-icd-opencl-dev ntpdate ubuntu-drivers-common gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget\n\n# time adjust\nln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime\nntpdate ntp.aliyun.com\n\n# install ulimit\nulimit -n 1048576\nsed -i \"/nofile/d\" /etc/security/limits.conf\necho \"* hard nofile 1048576\" >> /etc/security/limits.conf\necho \"* soft nofile 1048576\" >> /etc/security/limits.conf\necho \"root hard nofile 1048576\" >> /etc/security/limits.conf\necho \"root soft nofile 1048576\" >> /etc/security/limits.conf\n\n# setup SWAP, 64GB, swappiness=1\nSWAPSIZE=`swapon --show | awk 'NR==2 {print $3}'`\nif [ \"$SWAPSIZE\" != \"64G\" ]; then\n  OLDSWAPFILE=`swapon --show | awk 'NR==2 {print $1}'`\n  NEWSWAPFILE=\"/swapfile\"\n  if [ -n \"$OLDSWAPFILE\" ]; then\n    swapoff -v $OLDSWAPFILE\n    rm $OLDSWAPFILE\n    sed -i \"/\\$OLDSWAPFILE/d\" /etc/fstab\n    NEWSWAPFILE=$OLDSWAPFILE\n  fi\n  fallocate -l 64GiB $NEWSWAPFILE\n  chmod 600 $NEWSWAPFILE\n  mkswap $NEWSWAPFILE\n  swapon $NEWSWAPFILE\n  echo \"$NEWSWAPFILE none swap sw 0 0\" >> /etc/fstab\n  sysctl vm.swappiness=1\n  sed -i \"/swappiness/d\" /etc/sysctl.conf\n  echo \"vm.swappiness=1\" >> /etc/sysctl.conf\nfi\n\nsysctl vm.dirty_bytes=53687091200\nsed -i \"/dirty_bytes/d\" /etc/sysctl.conf\necho \"vm.dirty_bytes=53687091200\" >> /etc/sysctl.conf\n\nsysctl vm.dirty_background_bytes=10737418240\nsed -i \"/dirty_background_bytes/d\" /etc/sysctl.conf\necho \"vm.dirty_background_bytes=10737418240\" >> /etc/sysctl.conf\n\nsysctl vm.vfs_cache_pressure=1000\nsed -i \"/vfs_cache_pressure/d\" /etc/sysctl.conf\necho \"vm.vfs_cache_pressure=1000\" >> /etc/sysctl.conf\n\nsysctl vm.dirty_writeback_centisecs=100\nsed -i \"/dirty_writeback_centisecs/d\" /etc/sysctl.conf\necho \"vm.dirty_writeback_centisecs=100\" >> /etc/sysctl.conf\n\nsysctl vm.dirty_expire_centisecs=100\nsed -i \"/dirty_expire_centisecs/d\" /etc/sysctl.conf\necho \"vm.dirty_expire_centisecs=100\" >> /etc/sysctl.conf\n\n# install GPU driver\nnvidia-smi\nNEEDGPU=$?\nif [ $NEEDGPU -ne 0 ]; then\n  apt install -y nvidia-driver-440-server\n  echo \"reboot to make the GPU to take effect!\"\nfi\n"
  }
]