http://www.xiaoyenzi.com

Filecoin挖矿原理

IPFS中国社区

人人都是节点

Mining Filecoin

eshon edited this page 12 days ago · 56 revisions

Filecoin挖矿

eshon编辑此页12天前·56次修订

This guide provides an overview of how mining works, and a step-by-step of how to mine on the Filecoin network.

本指南概述了在Filecoin网络上进行挖矿的工作原理及相关步骤。

Table of Contents

What is mining?

Start mining

Explore mined blocks

Set your price for storage

Accept a deal and get paid

Stop mining

Advanced options

目录

什么是挖矿?

开始挖矿

探索已开采的区块

设置存储价格

接受交易并获得报酬

停止挖矿

高级选项

What is mining?

什么是挖矿?

In most blockchain protocols, "miners" are the participants on the network that do the work necessary to keep the blockchain valid and secure. For providing these services, miners are compensated in the native cryptocurrency. The term "miner" emerged to compare the work of securing blockchains with that of gold miners who expended resources to expand the supply of gold.

在大多数区块链协议中,“矿工”是网络上的参与者,他们负责保持区块链的有效性和安全性。为了提供这些服务,矿工获得原生加密货币作为到补偿。“矿工”一词的出现是来形容为了确保区块链的工作而花费资金扩大金币供应的金币挖矿者。

The Filecoin network will have multiple types of miners:

Storage miners

Retrieval miners

Repair miners (later)

In the current implementation, we focus mostly on storage miners. A storage miner sells storage capacity in exchange for filecoin.

Filecoin网络将有多种类型的矿工:

储存矿工

检索矿工

修复矿工(后面会有)

在目前的实施中,我们主要关注存储矿工。存储矿工销售存储量以换取filecoin。

Start mining

开始挖矿

After daemon has finished syncing the chain, you can create a miner.

By default, Filecoin nodes are not set up to mine. (See Getting Started for how to initialize a Filecoin node). Mining blocks on the Filecoin network requires committing storage capacity to the network. Blocks are mined, and block rewards earned, in proportion to the amount of storage committed.

在进程完成与链同步后,您可以创建一个矿工。

默认情况下,Filecoin节点未设置为我的。(有关如何初始化Filecoin节点,请参阅“入门”)。Filecoin网络上的挖掘区块需要向网络提交存储容量。开采区块,并根据提交的存储量成比例获得区块奖励。

A prospective miner begins by choosing a sector size and pledging collateral. A pledge involves sending a message on the Filecoin blockchain. Like Ethereum, messages cost "gas" to process, and each message specifies the maximum number of gas units it will consume, and a price per unit in FIL (Filecoin network tokens). For now, we can specify some fairly arbitrary numbers for these.

一个潜在的矿工首先要选择一个存储的规模,并抵押抵押品。承诺包括在Filecoin区块链上发送讯息。与以太坊类似,讯息处理需要花费“燃料”,每个讯息指定它将消耗的最大“燃料”单元数,以及FIL (Filecoin网络令牌)中的每个单元的价格。现在,我们可以为它们指定一些随机数字。

1.Create a miner with 100 FIL as collateral, using the default sector size (256MiB), with a message gas price of 0 FIL/unit and limit of 1000 gas units. When successful, it returns the miner address of the newly created miner.

1.使用默认扇区大小(256MiB)创建一个以100 FIL作为抵押品的矿工,一个讯息“燃料”价格为0 FIL / unit,限制为1000个“燃料”单位。成功时,将返回新创建的矿工地址。

Note: This step may take about a minute to process, but if it hangs for longer, double-check that gas-price is less than $YOUR_WALLET_BALANCE / LIMIT.

注意:这个步骤可能需要大约一分钟来处理,但是如果它处理的时间更长,请再次检查gas-price是否低于 $YOUR_WALLET_BALANCE / LIMIT.

go-filecoin miner create 100 --gas-price=0.001 --gas-limit=300 --peerid `go-filecoin id | jq -r '.ID'` # this may take a minute

2.Once the miner is created, we can run the following to start mining:

2.一旦创建了矿工,我们可以运行以下程序来开始挖掘:

go-filecoin mining start

go-filecoin挖矿开始了

Congrats, you are now mining blocks on the Filecoin network! Let's take a detour to explore these blocks. (Or, to begin mining your unused storage, skip directly to Set your price for storage.)

恭喜,您现在正在Filecoin网络上挖掘区块!让我们绕道去探索这些区块。(或者,要开始挖掘未使用的存储空间,请直接跳转到设置存储空间的价格。)

Explore mined blocks

探索采矿区块

You can explore the Filecoin blockchain using the Filecoin Block Explorer, or via the command line. For example, let's get the blockID of the very first block of the blockchain. This is known as the head.

您可以使用Filecoin区块资源管理器或通过命令行探索Filecoin区块链。例如,让我们获取区块链的第一个块的blockID 这被称为头部。

1.Show the chain head and copy the a blockID (there may be more than one):

1.显示链头并复制一个blockID (可能有多个):

go-filecoin chain head # returns JSON including the <blockID> of the chain head

2.Then, view the contents of that block with show block:

2.然后,使用show block查看该区块的内容:

go-filecoin show block <blockID>

Many commands also support a --enc=json option for machine-readable output.

对于机器可读的输出,许多命令还支持 --enc=json 选项。

Set your price for storage

设定存储价格

In the Filecoin storage market, miners run a command that sets their price for storage by creating an ask order that provide some detail on their available storage space and how much they are charging for storage. Clients propose deals to miners for the files they want to store. Setting a price requires the following values:

在Filecoin存储市场中,矿工运行一个命令,通过创建一个询问订单来设置他们的存储价格,该订单提供了他们可用存储空间的一些细节以及他们为存储收取的费用。客户向矿工提出他们想要存储的文件的交易。设置价格需要以下值:

1.the price at which you are willing to sell that much storage (in FIL/byte/block)

2.the number of blocks for which this asking price is valid

3.the price to pay for each gas unit consumed mining this message (in FIL)

4.the maximum number of gas units to be consumed by this message

1.您愿意以什么价格卖出这么多存储空间(以FIL /字节/块为单位)

2.这个有效要价的区块数

3.开采这条信息所消耗的每一单位“燃料”的价格(单位:FIL)

4.此讯息要消耗的最大“燃料”单位数

Let's set our price!

我们定下价格吧!

1.We set our price to 0.000000001 FIL/byte/block, valid for 2880 blocks, with a message gas price of 0.001 FIL/unit and limit of 1000 gas units:

1.我们将价格设定为0.000000001 FIL /字节/块,对2880块有效,讯息“燃料”价为0.001 FIL /单位,限制为1000个“燃料”单位:

go-filecoin miner set-price --gas-price=0.001 --gas-limit=1000 0.000000001 2880

2.Once you have set your price, you can check client list-asks to see your ask (look for your miner address):

2.一旦设定了价格,就可以查看客户列表 - 要求查看您的询问(查找您的矿工地址):

go-filecoin client list-asks --enc=json | jq

Accept a deal and get paid

接受交易并获得报酬

Clients propose storage deals to miners who have enough storage and at a price that is lower than their willingness to pay. Currently, miners accept all deals that are proposed to them by clients with sufficient funds. Payment validation is done automatically so you don't have to take any action to accept a deal that pays you your asking price. Deal payments are implemented using filecoin's builtin payment channels. Thus, miners are periodically credited funds in a payment channel throughout the lifetime of the deal.

客户向拥有足够存储空间且价格低于其支付意愿的矿工提出存储交易。目前,矿工接受客户用足够资金向他们提出的所有交易。付款验证是自动完成的,因此您无需采取任何行动来接受支付您要价的交易。交易付款使用filecoin的内置付款渠道实施。因此,在整个交易期间,矿工会通过支付渠道定期获得资金贷记。

To see all deals your miner has made run

查看您的矿工进行的所有交易

go-filecoin deals list --miner

You will see a list of meta data about deals looking something like this:

您将看到有关此类交易的元数据列表:

{

"minerAddress": "t2mpmyigmpopcwguhe2tpdeonoppuht5mtvd2ljcq",

"pieceCid": {

"/": "QmbHmUVAkqZjQXgifDady7m5cYprX1fgtGaTYxUBBTX3At"

},

"proposalCid": {

"/": "zDPWYqFD8U3ktr58iiqWTwzEV3sKyz7SGQjLg1zKS1Mgpo5N2nr1"

},

"state": "staged"

}

To get more information about a specific deal run

获取有关特定交易的更多信息

go-filecoin deals show <proposal-cid>

In the above example <proposal-cid>would be

在上面的例子中<proposal-cid>应该是

zDPWYqFD8U3ktr58iiqWTwzEV3sKyz7SGQjLg1zKS1Mgpo5N2nr1.

You can inspect a deal's state, how long the agreed storage period is, and how much you will get paid for honoring the deal.

您可以查看交易的状态、约定的存储期有多长,以及履行交易将获得多少报酬。

When the deal duration is up you can redeem your full payment by running

交易持续时间结束后,您可以通过运行以下代码兑换全额付款

go-filecoin deals redeem --gas-price=0.001 --gas-limit=1000 <proposal-cid>

This will submit a message to the blockchain redeeming funds from the payment channel set up between you and your client. Wait for the output message to be processed by the network and voila! You will now see the deal's payout in your wallet.

这将向区块链提交一条讯息,从您和您的客户之间建立的支付通道中赎回资金。等待网络处理输出讯息,瞧!现在你将会在你的钱包里看到这笔交易的付款。

Stop mining

停止挖矿

If at any point you want to stop mining, you can always stop:

如果你想在任何时候停止挖矿,你可以随时停止:

go-filecoin mining stop

You can also remove all data associated with your Filecoin node instance:

您还可以删除与您的Filecoin节点实例关联的所有数据:

Advanced options

高级选项

Specify where client data is stored

There are two ways to specify the location of the sector storage directory:

指定客户端数据的存储位置

有两种方法可以指定扇区存储目录的位置:

the sectorbase.rootdir config entry

the --sectordir option to go-filecoin init

sectorbase.rootdir配置项

go- filecoin init的--sectordir选项

If you don’t specify a location, data is stored in a directory named .filecoin_sectors underneath the parent directory of the filecoin repo directory by default.

如果未指定位置,则默认情况下,数据存储在filecoin repo目录的父目录下名为.filecoin_sectors的目录中。

repo-dir-parent ($HOME by default)

repo-dir

filecoin_sectors

See something missing? Have tips to share? File an issue, and we'll follow up as soon as possible. (If you have write permission in this repo, feel free to edit directly.)

看到缺少的东西?有什么要分享的吗?提出问题,我们会尽快跟进。(如果您在此报告中拥有编辑权限,请随意直接编辑。)

文章来源:https://github.com/filecoin-project/go-filecoin/wiki/Mining-Filecoin#set-your-price-for-storage

翻译:Bob

什么是IPFS?

IPFS是一个分布式的存储项目,与激励层Filecoin形成了一个有效的市场闭环,构建出一个去中心化存储网络系统。

Filecoin是2017年最大的私募项目,短短时间募集了2.57亿美元。

目前期货价格约45.5元左右,按照20亿枚Token计算,未上线已市值910亿人民币。

我们是IPFS中国社区,垂直专注于IPFS领域,努力提供客观的、第三方的IPFS、Filecoin、挖矿等最新资讯,共同推进IPFS相关应用的发展,建立一个良好的IPFS生态圈。

热门阅读

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。