blockchain

Error invoking chaincode using Node.js SDK [TypeError: Cannot read property 'getConnectivityState' of undefined]

让人想犯罪 __ 提交于 2019-12-07 00:46:27
Failed to invoke successfully :: TypeError: Cannot read property 'getConnectivityState' of undefined /opt/share/hyperledger/node_modules/fabric-client/lib/EventHub.js:355 if(self._stream) state = self. stream.call.channel .getConnectivityState(); ^ TypeError: Cannot read property 'getConnectivityState' of undefined at ClientDuplexStream.<anonymous> (/opt/share/hyperledger/node_modules/fabric-client/lib/EventHub.js:355:56) at emitOne (events.js:116:13) at ClientDuplexStream.emit (events.js:211:7) at ClientDuplexStream._emitStatusIfDone (/opt/share/hyperledger/node_modules/grpc/src/client.js:236

How is the source code protected from being tampered with in a blockchain?

白昼怎懂夜的黑 提交于 2019-12-06 17:25:52
class Block{ constructor(timestamp, transactions, previousHash = ''){ this.timestamp = timestamp; this.transactions = transactions; this.previousHash = previousHash; this.hash = this.calculateHash(); this.nonce = 0; } calculateHash(){ return SHA256(this.previousHash + JSON.stringify(this.transactions) + this.timestamp + this.nonce).toString(); } mineBlock(difficulty){ while(this.hash.substring(0, difficulty) !== Array(difficulty + 1).join("0")){ this.nonce++; this.hash = this.calculateHash(); } console.log("Block mined: " + this.hash); } } In the above code, how is it promised that the

Quorum Ethereum Truffle) Error: Number can only safely store up to 53 bits

放肆的年华 提交于 2019-12-06 15:21:05
I am actually learning smart contract programming on ethereum and I work with truffle. Right now I am making this tutorial here: https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains Where you learn how to create a dapp with quorum. But now I have a problem. I did everything exactly as described, but when I do: truffle migrate I get this error here: $ truffle migrate ⚠️ Important ⚠️ If you're using an HDWalletProvider, it must be Web3 1.0 enabled or your migration will hang. Starting migrations... ====================== > Network name: 'development' >

In Hyperledger Fabric, Blocks locations and validity criteria

╄→尐↘猪︶ㄣ 提交于 2019-12-06 14:33:35
问题 Full disclosure, some users have asked about this but the answers have somehow diverted leaving the actual question unanswered. So, In Hyperledger Fabric: Where are the physical block files stored on a peer instance? How Often or when is the World State validated against the underlying ledger/blockchain? I know that LevelDB is used for the World State and it can be switched to CouchDB and I read somewhere that the ledger is also indexed in LevelDB but that again could refer to the World State

Hyperledger fabric's ChannelCreationPolicy

有些话、适合烂在心里 提交于 2019-12-06 13:50:27
问题 I am struggling so hard to write policy for creating channel (ChannelCreationPolicy) here is my configtx.yaml --- Organizations: - &OrdererOrg Name: OrdererOrg ID: OrdererMSP MSPDir: ../crypto-config/ordererOrganizations/orderer-org/msp - &ShopOrg Name: ShopOrgMSP ID: ShopOrgMSP MSPDir: ../crypto-config/peerOrganizations/shop-org/msp AnchorPeers: - Host: shop-peer-0 Port: 7051 Orderer: &OrdererDefaults OrdererType: solo Addresses: - orderer0:7050 BatchTimeout: 2s BatchSize: MaxMessageCount:

PROTOBUF_INLINE_NOT_IN_HEADERS

谁说我不能喝 提交于 2019-12-06 12:05:04
I'm trying to install Open Transactions, the open-source project, on a debian 8. I've installed all the dependencies and am having an issue when compiling (make). The following error is showing at my terminal, even though i made sure to install the protobuf project: In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:64:0, from /root/opentxs/src/core/OTStorage.cpp:47: /root/opentxs/build/src/core/otprotob/Generics.pb.h:501:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef] #if !PROTOBUF_INLINE_NOT_IN_HEADERS ^ In file included from /root

Set up of Hyperledger fabric on 2 different PCs

折月煮酒 提交于 2019-12-06 10:03:29
I need to run Hyperledger-Fabric instances on 4 different machines PC-1 should contain CA and peers of ORG-1 in containers, Pc-2 should contain CA and peers of ORG-2, PC-3 should contain orderer(solo) and PC-4 should Node api Is my approach missing something ? if not how can I achieve this? I would recommend that you look at the Ansible driver in Hyperledger Cello project to manage deployment across multiple hosts/vms. In short, you need to establish network visibility across the set of host/vm nodes such that the peer knows about the orderer to which it will connect and so that gossip can

Cannot put state in query context

◇◆丶佛笑我妖孽 提交于 2019-12-06 07:24:21
Im trying to use a ticker in my chaincode to update the chaincode state periodically, based on some condition: func (t *SimpleChaincode) Invoke(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) { ticker := time.NewTicker(time.Millisecond * 10000) go func() { for t := range ticker.C { fmt.Println("Tick at", t) a = a+5 err:= stub.PutState("a", []byte(strconv.Itoa(a))) fmt.Println(err.Error()) } }() return nil, nil } I am sending the invoke transaction using the chaincode REST api for invoke : POST http://<ip>:<port>/chaincode { "jsonrpc": "2.0", "method": "invoke",

How to efficiently hash (SHA 256) in golang data where only the last few bytes changes

让人想犯罪 __ 提交于 2019-12-06 06:57:17
问题 Assuming you had 80 bytes of data and only the last 4 bytes was constantly changing, how would you efficiently hash the total 80 bytes using Go. In essence, the first 76 bytes are the same, while the last 4 bytes keeps changing. Ideally, you want to keep a copy of the hash digest for the first 76 bytes and just keep changing the last 4. 回答1: You can try the following examples on the Go Playground. Benchmark results is at the end. Note: the implementations below are not safe for concurrent use

Can a World State variable be accessed by a chaincode different from the one that deployed it?

对着背影说爱祢 提交于 2019-12-06 04:46:45
If a chaincode A stores a variable V to the World State can this variable V be accessed by another chaincode B? In other words, are variables in the World State access protected? If it is not possible, how can I make chaincode B read the variables from chaincode A (I need it for my use case)? No, variables stored by some chaincode A can only be accessed by the same chaincode A. So if a chaincode B tries to access the variable V, access will be denied. If you wanted to access such variables (because your use case requires interconnection between chaincodes) you can invoke/query chaincode A from