我用Docker镜像设置了Hyperledger Fabric V0.6.我写了小链代码程序并执行一些操作.根据Hyperledger区块链的请求存储和获取数据.
我重新开始我的链代码程序,数据仍然存在.Ofcouse这应该是预期的行为.
但是,当我使用命令docker-compose停止我的Hyperledger结构并使用docker-compose start再次启动它然后启动我的chaincode程序时,我发现在重启之前写入的整个数据都消失了.我在区块链中找不到任何数据.
如何避免Hyperledger的这种行为?我在单个对等体/节点上运行它.对于多个对等体,如果其中一个对等体重新启动,则来自其他对等体的数据/事务将被复制到其上.但考虑到最糟糕的情况,所有同行都会失败.这是否意味着我们放弃了所有数据?
docker blockchain docker-compose hyperledger hyperledger-fabric
您能否解释Hyperledger Fabric v1.0中的一些隐私机制 - 那些已经实施的以及计划在未来实施的那些机制?
我理解渠道就像是单独的区块链.我还浏览了https://jira.hyperledger.org/browse/FAB-1151上的文档,在那里我找到了另外两种机制:一种是私有数据,另一种是加密.你能解释一下在下面的场景中使用的野兽方法吗?
每辆车都需要汽车保险.假设汽车的所有者想要改变他的保险公司.他与新保险公司签订合同.比方说,还有一个监管机构.新的保险公司向监管机构通报新合同.然后,监管机构通知旧保险公司,该车不再在那里投保,但没有告知他们新保险公司的名称.因此,我们拥有在网络中共享的资产,但也有一些私人数据,只有一些参与者才能看到.我猜这是一个链,所以使用多个通道在这里没有任何意义.
我并没有完全掌握私人数据的概念.这些数据是否应该仅对一个同行/公司是私有的,还是可以在多个公司之间共享,但不是全部共享?这是在场景中的方式吗?使用加密与私有数据有什么不同的原因/用例?在描述的场景中应该使用什么机制?
我正在玩hyperledger-fabric v.1.0 - 实际上是一个新手.如何检查链条高度?是否有命令或其他东西我可以用来"询问"区块链高度?提前致谢.
我用BYFN将认可政策从"OR"改为"AND" 并实例化了Chaincode.但是,即使在执行Invoke之后,分类帐中的数据也不会更改.我确认"OR"条件正在运行.(分类帐中的数据已更改)
请告诉我如何解决它.
peer chaincode instantiate -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "**OR** ('Org1MSP.member','Org2MSP.member')"
Run Code Online (Sandbox Code Playgroud)
==>
peer chaincode instantiate -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "**AND** ('Org1MSP.member','Org2MSP.member')"
Run Code Online (Sandbox Code Playgroud) I was trying to create a custom business network based on the specification described here: https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#using-couchdb
I have created 5 peers for org1.example.com and one peer for org2.example.com.
I am able to start the network and to install chain-code using docker cli on peer0.org1.example.com, but when I try to instantiate it, I get he following error:
Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: API error (404): {"message":"network _byfn not found"}
Here is the …
当我尝试进行查询时:
query PapersFromAPoll
{
description: "retrieve all the papers from a poll"
statement:
SELECT org.acme.democracity.Paper
WHERE(poll.pollId == _$id)
}
Run Code Online (Sandbox Code Playgroud)
我无法获取任何行,这是我进行此查询的片段:
return query('PapersFromAPoll',{id : count.poll.pollId})
这很奇怪,因为当我擦除WHERE语句并且我做一个没有任何参数的简单查询时它完美地工作.
在model.cto文件中的纸张和轮询:
asset Paper identified by paperId {
o String paperId
o String[] fields
--> Poll poll //Paper related with a poll
}
asset Poll identified by pollId {
o String pollId
o Ask[] asks
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用javascript向Hyperledger Sawtooth v1.0.1提交一个事务到在localhost上运行的验证器.邮寄请求的代码如下:
request.post({
url: constants.API_URL + '/batches',
body: batchListBytes,
headers: { 'Content-Type': 'application/octet-stream' }
}, (err, response) => {
if (err) {
console.log(err);
return cb(err)
}
console.log(response.body);
return cb(null, response.body);
});
Run Code Online (Sandbox Code Playgroud)
从后端nodejs应用程序提交时会处理事务,但从OPTIONS http://localhost:8080/batches 405 (Method Not Allowed)客户端提交时会返回错误.这些是我尝试过的选项:
Access-Control-Allow-*使用扩展名将标头插入响应中:响应仍然会产生相同的错误删除自定义标头以绕过预检请求:这会使验证程序抛出错误,如下所示:
...
sawtooth-rest-api-default | KeyError: "Key not found: 'Content-Type'"
sawtooth-rest-api-default | [2018-03-15 08:07:37.670 ERROR web_protocol] Error handling request
sawtooth-rest-api-default | Traceback (most recent call last):
...
Run Code Online (Sandbox Code Playgroud)POST来自浏览器的未修改请求从验证器获取以下响应头:
HTTP/1.1 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
Allow: GET,HEAD,POST …Run Code Online (Sandbox Code Playgroud) 我想建立Hyperledger Fabric样本的第一个网络
我从git获得了简单的代码,然后按照指南http://hyperledger-fabric.readthedocs.io/en/v1.0.5/samples.html下载了特定于平台的二进制文件, 但是当我运行命令./byfn.sh时- m生成屏幕上有不同的输出,当我运行./byfn.sh -m up时,发生了错误
Build your first network (BYFN) end-to-end test
Channel name : mychannel
Creating channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=2
+ set +x
2018-04-04 09:59:34.078 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fc6bfc34259]
runtime stack: …Run Code Online (Sandbox Code Playgroud) 我目前正在使用Hyperledger Fabric样本。我已经根据可用的教程成功运行了first-network和fabcar。我现在正在尝试将两者结合起来,以在一个组织中与3个对等方组成一个网络,并使用节点sdk进行查询,等等。这里提供了我当前的fabric-samples目录的回购。我已经能够使用byfn.sh构建网络,enrollAdmin.js和registerUser.js。尝试查询或调用时遇到了以下问题:
Store path:/home/victor/fabric-samples/first-network/hfc-key-store
Successfully loaded user1 from persistence
Assigning transaction_id: bc0240f672d075de2f84d50b292ed0e2214dacc0ef2888d0fa7e25d872a99b03
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
at new createStatusError (/home/victor/fabric-samples/first-network/node_modules/grpc/src/client.js:64:15)
at /home/victor/fabric-samples/first-network/node_modules/grpc/src/client.js:583:15
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
at new createStatusError (/home/victor/fabric-samples/first-network/node_modules/grpc/src/client.js:64:15)
at /home/victor/fabric-samples/first-network/node_modules/grpc/src/client.js:583:15
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
at new createStatusError …Run Code Online (Sandbox Code Playgroud) 我想向现有的运行网络中添加新的订购者。目前我的网络如下:
泊坞窗ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
998b93eb81c6 hyperledger/fabric-tools:latest "/bin/bash" About a minute ago Up About a minute cli
87bada2d914b hyperledger/fabric-orderer:latest "orderer" About a minute ago Up About a minute 0.0.0.0:8050->7050/tcp orderer2.example.com
5907f35bb5b4 hyperledger/fabric-orderer:latest "orderer" About a minute ago Up About a minute 0.0.0.0:8750->7050/tcp orderer6.example.com
7876e35f2fb9 hyperledger/fabric-orderer:latest "orderer" About a minute ago Up About a minute 0.0.0.0:10050->7050/tcp orderer4.example.com
fba3185ec9c6 hyperledger/fabric-peer:latest "peer node start" About a minute ago Up About a minute 0.0.0.0:7051->7051/tcp peer0.org1.example.com
8b5e4348f04c hyperledger/fabric-orderer:latest "orderer" …Run Code Online (Sandbox Code Playgroud)