# Hyperledger Korea UserGroup Meetup
# 2019๋ 09์ 21์ผ
# ์ฃผ์
- ํ์ดํผ๋ ์ 2.0๊ณผ ์ด์ ๋ฒ์ ๊ณผ์ ๋น๊ต
- ํ์ดํผ๋ ์ ํจ๋ธ๋ฆญ์ MSP ๋์๋ฐฉ์ ํ์ธ : ์์ฌ์.
- Fabric high-throughput : ํฅ๋ฏธ๋ก์ด ๋ถ๋ถ
- ์ฟ ๋ฒ๋คํฐ์ค ๊ธฐ๋ฐ Hyperledger Fabric 30๋ถ๋ง์ ๋ง๋ณด๊ธฐ : ์๊ฐ์ด ์์ด์ ๊ฑฐ์ ์งํ ์ํจ.
# ํ์ดํผ๋ ์ 2.0๊ณผ ์ด์ ๋ฒ์ ๊ณผ์ ๋น๊ต
# Token Cli ์ค์
/tmp
์ json
ํ์ผ ์์ฑ
configorg1.json
{ "ChannelID":"", "MSPInfo":{ "MSPConfigPath":"", "MSPID":"Org1MSP", "MSPType":"bccsp" }, "Orderer":{ "Address":"orderer.example.com:7050", "ConnectionTimeout":0, "TLSEnabled":true, "TLSRootCertFile":"/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem", "ServerNameOverride":"" }, "CommitterPeer":{ "Address":"peer0.org1.example.com:7051", "ConnectionTimeout":0, "TLSEnabled":true, "TLSRootCertFile":"/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", "ServerNameOverride":"" }, "ProverPeer":{ "Address":"peer0.org1.example.com:7051", "ConnectionTimeout":0, "TLSEnabled":true, "TLSRootCertFile":"/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", "ServerNameOverride":"" } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29configorg2.json
{ "ChannelID":"", "MSPInfo":{ "MSPConfigPath":"", "MSPID":"Org2MSP", "MSPType":"bccsp" }, "Orderer":{ "Address":"orderer.example.com:7050", "ConnectionTimeout":0, "TLSEnabled":true, "TLSRootCertFile":"/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem", "ServerNameOverride":"" }, "CommitterPeer":{ "Address":"peer0.org2.example.com:9051", "ConnectionTimeout":0, "TLSEnabled":true, "TLSRootCertFile":"/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt", "ServerNameOverride":"" }, "ProverPeer":{ "Address":"peer0.org2.example.com:9051", "ConnectionTimeout":0, "TLSEnabled":true, "TLSRootCertFile":"/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt", "ServerNameOverride":"" } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29shares.json
[ { "recipient":"Org2MSP:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp", "quantity":"50" } ]
1
2
3
4
5
6
# BYFN ๊ตฌ๋
# FabToken ์ค์ต์์ ์ฌ์ฉํ ์ค์ ํ์ผ ํ์ธ
$ ls /tmp/*.json
/tmp/configorg1.json /tmp/configorg2.json /tmp/shares.json
# BYFN ๊ตฌ๋
$ cd $HOME/meetup/1906/fabric-samples/first-network/
$ ./byfn.sh up
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
LOCAL_VERSION=2.0.0
DOCKER_IMAGE_VERSION=2.0.0-alpha
=================== WARNING ===================
Local fabric binaries and docker images are
out of sync. This may cause problems.
...
========= All GOOD, BYFN execution completed ===========
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ cp /tmp/*.json $HOME/meetup/1906/fabric-samples/first-network/crypto-config
$ cd $HOME/meetup/1906/fabric-samples/first-network/crypto-config
$ ls *.json
configorg1.json configorg2.json shares.json
1
2
3
4
5
2
3
4
5
# FabToken ์ค์ต
# CLI ์ปจํ
์ด๋ ์ ์
$ docker exec -it cli bash
bash-4.4#
bash-4.4# ls
channel-artifacts/ crypto/ log.txt mycc.tar.gz mychannel.block scripts/
bash-4.4# cd crypto/
# ์ค์ ํ์ผ ํ์ธ
bash-4.4# ls
configorg1.json configorg2.json ordererOrganizations/ peerOrganizations/ shares.json
bash-4.4#
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Issue
- ํ ํฐ๋ช : BYFNcoins
- ์๋: 100
- ์์ ์: User1@org1.example.com
bash-4.4# token issue \
--config /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/configorg1.json \
--mspPath /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp \
--channel mychannel \
--type BYFNcoins \
--quantity 100 \
--recipient Org1MSP:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp
Orderer Status [SUCCESS]
Committed [true]
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
List
bash-4.4# token list \
--config /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/configorg1.json \
--mspPath /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp \
--channel mychannel
{"tx_id":"0b6f347a438399c24c5aa00a78d58a20cd6a89c6700ad3ad0fdccf8f90ee1c54"}
[BYFNcoins,100]
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Transfer
- Token ID: ๋ชฉ๋ก ์กฐํ๋ก ํ์ธ๋ "tx_id"ํค๋ฅผ ํฌํจํ๋ JSON
- ์์ ์: User1@org2.example.com
- ์ ์ก ์๋: 50
bash-4.4# token transfer \
--config /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/configorg1.json \
--mspPath /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp \
--channel mychannel \
--tokenIDs '[{"tx_id":"0b6f347a438399c24c5aa00a78d58a20cd6a89c6700ad3ad0fdccf8f90ee1c54"}]' \
--shares /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/shares.json
Orderer Status [SUCCESS]
Committed [true]
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
ํ ํฐ์๋ ํ์ธ
# User1@org1.example.com ํ ํฐ ์กฐํ
bash-4.4# token list \
--config /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/configorg1.json \
--mspPath /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp \
--channel mychannel
{"tx_id":"14d97dac90a9acc68432abaad7192eafb46887a2cb8b469b7db43ad07d27e5d1","index":1}
[BYFNcoins,50]
# User1@org2.example.com ํ ํฐ ์กฐํ
bash-4.4# token list \
--config /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/configorg2.json \
--mspPath /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp \
--channel mychannel
{"tx_id":"14d97dac90a9acc68432abaad7192eafb46887a2cb8b469b7db43ad07d27e5d1"}
[BYFNcoins,50]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Redeem
- Token ID: ๋ชฉ๋ก ์กฐํ๋ก ํ์ธ๋ "tx_id"ํค๋ฅผ ํฌํจํ๋ JSON
- ์์ ์: User1@org1.example.com
- ์ํ ์๋: 25
bash-4.4# token redeem \
--config /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/configorg1.json \
--mspPath /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp \
--channel mychannel \
--tokenIDs '[{"tx_id":"14d97dac90a9acc68432abaad7192eafb46887a2cb8b469b7db43ad07d27e5d1","index":1}]' \
--quantity 25
Orderer Status [SUCCESS]
Committed [true]
bash-4.4# token list \
--config /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/configorg1.json \
--mspPath /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp \
--channel mychannel
{"tx_id":"921e4e8efdd8ff8246a3d6d19828b4e2665db6bfaefc1ae6bc73066d75dee1e6","index":1}
[BYFNcoins,25]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15