Comments (3)
環境構築
reset
$ docker stop $(docker ps -q)
$ docker rm $(docker ps -aq)
$ CONTRACT_IMAGE=$(docker images \| grep 'dev-peer0.org1.example.com-papercontract' \| awk '{print $3}')
$ docker rmi $CONTRACT_IMAGE
base network
$ cd basic-network/
$ ./start.sh
monitor起動
以下はずっと起動しっぱなしになる。
$ cd ../estate/configuration/cli/
$ ./monitordocker.sh net_basic
fabric-toolsの起動
hyperledgerとコミュニケーション取るためのもの
$ cd estate/configuration/cli
$ docker-compose -f docker-compose.yml up -d cliMagnetoCorp
Creating cliMagnetoCorp ... done
chaincodeのインストール
peer chaincode install を cliMagnetoCorp で実行する
$ docker exec cliMagnetoCorp peer chaincode install -n estatecontract -v 0 -p /opt/gopath/src/github.com/contract -l node
2019-06-06 01:44:32.834 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-06-06 01:44:32.835 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-06-06 01:44:33.278 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
chaincodeのinstantiate
peer chaincode instantiate を cliMagnetoCorpで実施する。
docker exec cliMagnetoCorp peer chaincode instantiate -n estatecontract -v 0 -l node -c '{"Args":["org.estatenet.estate:instantiate"]}' -C mychannel -P "AND ('Org1MSP.member')"
createEstate.js 動かす
$ cd estate/application
$ npm install
wallet追加
user1
$ node addToWallet.js
done
user2
$ node addToWallet.js
done
createEstate.js実行
$ node createEstate.js
Connect to Fabric gateway.
Use network channel: mychannel.
Use org.estatenet.estate smart contract.
Submit estate issue transaction.
Process estate transaction response.
undefined estate : SCFoundation successfully created. price 50000000
Transaction complete.
Disconnect from Fabric gateway.
Estate program complete.
成功した 👍
from estate-sample.
chaincodeのinstantiate時にcompileエラー
docker exec cliMagnetoCorp peer chaincode instantiate -n papercontract -v 0 -l node -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' -C mychannel -P "AND ('Org1MSP.member')"
:
dev-peer0.org1.example.com-estatecontract-0|{ Error: Cannot find module '../../ledger-api/state.js'
dev-peer0.org1.example.com-estatecontract-0| at Function.Module._resolveFilename (module.js:547:15)
dev-peer0.org1.example.com-estatecontract-0| at Function.Module._load (module.js:474:25)
dev-peer0.org1.example.com-estatecontract-0| at Module.require (module.js:596:17)
dev-peer0.org1.example.com-estatecontract-0| at require (internal/module.js:11:18)
dev-peer0.org1.example.com-estatecontract-0| at Object.<anonymous> (/usr/local/src/lib/estate.js:8:15)
dev-peer0.org1.example.com-estatecontract-0| at Module._compile (module.js:652:30)
dev-peer0.org1.example.com-estatecontract-0| at Object.Module._extensions..js (module.js:663:10)
dev-peer0.org1.example.com-estatecontract-0| at Module.load (module.js:565:32)
dev-peer0.org1.example.com-estatecontract-0| at tryModuleLoad (module.js:505:12)
dev-peer0.org1.example.com-estatecontract-0| at Function.Module._load (module.js:497:3) code: 'MODULE_NOT_FOUND' }
該当の estate.js のソースを以下にかえても、まったく上のエラーと同じ。何かキャッシュが残っている?
const State = require('../ledger-api/aaaa-state.js');
dockerの全削除してみるか、、、うまくいかない
image削除しないとだめかもしれない、、、、
結局、dev-peer0.org1.example.com-estatecontract-0 を消したら大丈夫だった 👍
from estate-sample.
estateを全て取得するchaincodeが動かない。
async findByQuery(query) {
let iterator = await this.ctx.stub.GetQueryResult(query);
const allResults = [];
while (true) {
const res = await iterator.next();
if (res.value && res.value.value.toString()) {
console.log(res.value.value.toString('utf8'));
const Key = res.value.key;
let Record;
try {
Record = JSON.parse(res.value.value.toString('utf8'));
} catch (err) {
console.log(err);
Record = res.value.value.toString('utf8');
}
allResults.push({ Key, Record });
}
if (res.done) {
console.log('end of data');
await iterator.close();
console.info(allResults);
// return JSON.stringify(allResults);
return allResults;
}
}
}
を実行すると以下エラー。
TypeError: this.ctx.stub.GetQueryResult is not a function, stack=Error: transaction returned with failure: TypeError: this.ctx.stub.GetQueryResult is not a function
GetQueryResultがないと。
とおもったら、getQueryResult になおしたらうまくいった汗
https://www.ibm.com/developerworks/jp/cloud/library/cl-hyperledger-fabric-couchdb-serach/index.html
の記載のtypoだわいな
from estate-sample.
Related Issues (15)
- 要件定義
- データモデル定義 HOT 3
- nodeのフレームワーク選定 HOT 3
- 開発方針の決定 HOT 6
- fabricのロールバック処理対応
- 起動用script作成
- Estate売買実装 HOT 6
- Client側で秘密鍵&公開鍵を作成してtransaction実行させてみる HOT 5
- ReactNativeでfabricのlib使えるかサンプルアプリ作成 HOT 7
- Node.js が使えるクライアントアプリを見つけてfabric libを使う HOT 13
- queryByChaincode が offlineでも使えるか調べる HOT 6
- sendSignProposalを調べる HOT 3
- fabric-ca-client の中身を探る
- Electronで画面を作る HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from estate-sample.