Hyperledger Fabric 中锚交易文件的用途是什么?

What is the purpose of anchor transaction file in Hyperledger Fabric?

在 channel.tx 文件之后的 BYFN 文档中,它生成 ORG1MSPanchors.tx

Next, we will define the anchor peer for Org1 on the channel that we are constructing.

../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP

我明白创建交易文件的目的,但它用在什么地方?

genesis.block - 用于创建频道
channel.tx - 用于创建频道
ORG1MSPanchors.tx -- 用在什么地方?

这是锚节点concept:

A peer node on a channel that all other peers can discover and communicate with. Each Member on a channel has an anchor peer (or multiple anchor peers to prevent single point of failure), allowing for peers belonging to different Members to discover all existing peers on a channel.

当您使用 channel.tx 创建频道时,默认情况下没有定义锚点。为此,您需要对其进行设置。在您第一次更新锚点交易时,将设置您的锚点的地址和 MSP。 所以继续 BYFN 教程,你需要告诉网络你已经设置了一个新的锚节点创建一个配置通道更新交易:

peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/Org1MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

通道配置是任何结构网络的主要组成部分。如果在网络中进行任何更改,例如网络中的新组织或将现有对等点作为锚点对等点,则通道不会意识到这些更改。因此,要将这些更改作为频道的一部分,我们必须更新频道配置。

如果要将点作为锚点点,我们必须使用 configtxgen tool-outputAnchorPeersUpdate 标志创建一个新的 anchorpeer.tx 文件。

现在,需要更新此生成的 tx 文件通道配置。这将通知通道特定对等点现在是锚点对等点。

要查看如何更新,请按照 对这个问题的回答。

锚节点更新仅适用于频道创建后的第一次更新。请阅读此 - https://lists.hyperledger.org/g/fabric/topic/68669467#7419

如果有人发现了在第一次更新后添加锚点更新的不同方法,那将非常有帮助。我处于这样一种情况,我需要在创建频道后将组织添加到频道,并且由于此限制,我无法将任何锚点添加到组织。