Skip to content

Commit 9462fc5

Browse files
committed
Update mainchannel
Signed-off-by: David VIEJO <[email protected]>
1 parent 610ce76 commit 9462fc5

File tree

9 files changed

+465
-56
lines changed

9 files changed

+465
-56
lines changed

README.md

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This workshop provides an in-depth, hands-on discussion and demonstration of usi
6060

6161
| | |
6262
|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
63-
| ![galagames logo](https://avatars.githubusercontent.com/u/135145372?s=200&v=4) | Gala Games is a blockchain gaming platform that empowers players to earn cryptocurrencies and NFTs through gameplay. Founded in 2018 by Eric Schiermeyer, co-founder of Zynga, it aims to create a new type of gaming experience. The platform offers limited edition NFTs and allows players to earn Gala tokens s |
63+
| ![galagames logo](https://avatars.githubusercontent.com/u/135145372?s=200&v=4) | Gala Games is a blockchain gaming platform that empowers players to earn cryptocurrencies and NFTs through gameplay. Founded in 2018 by Eric Schiermeyer, co-founder of Zynga, it aims to create a new type of gaming experience. The platform offers limited edition NFTs and allows players to earn Gala tokens |
6464
| ![kfs logo](https://avatars.githubusercontent.com/u/74511895?s=200&v=4) | If you want to design and deploy a secure Blockchain network based on the latest version of Hyperledger Fabric, feel free to contact [email protected] or visit [https://kfs.es/blockchain](https://kfs.es/blockchain) |
6565

6666
## Getting started
@@ -327,18 +327,57 @@ kubectl hlf peer create --statedb=leveldb --image=$PEER_IMAGE --version=$PEER_VE
327327
--hosts=peer0-org1.localho.st --istio-port=443
328328

329329

330-
kubectl hlf peer create --statedb=leveldb --image=$PEER_IMAGE --version=$PEER_VERSION --storage-class=$SC_NAME --enroll-id=peer --mspid=Org1MSP \
331-
--enroll-pw=peerpw --capacity=5Gi --name=org1-peer1 --ca-name=org1-ca.default \
332-
--hosts=peer1-org1.localho.st --istio-port=443
333-
334330
kubectl wait --timeout=180s --for=condition=Running fabricpeers.hlf.kungfusoftware.es --all
335331
```
336332

337333
Check that the peer is deployed and works:
338334

339335
```bash
340336
openssl s_client -connect peer0-org1.localho.st:443
341-
openssl s_client -connect peer1-org1.localho.st:443
337+
```
338+
339+
340+
## Deploy Org2
341+
342+
### Deploy a certificate authority
343+
344+
```bash
345+
kubectl hlf ca create --image=$CA_IMAGE --version=$CA_VERSION --storage-class=$SC_NAME --capacity=1Gi --name=org2-ca \
346+
--enroll-id=enroll --enroll-pw=enrollpw --hosts=org2-ca.localho.st --istio-port=443
347+
348+
kubectl wait --timeout=180s --for=condition=Running fabriccas.hlf.kungfusoftware.es --all
349+
```
350+
351+
Check that the certification authority is deployed and works:
352+
353+
```bash
354+
curl -k https://org2-ca.localho.st:443/cainfo
355+
```
356+
357+
Register a user in the certification authority of the peer organization (Org2MSP)
358+
359+
```bash
360+
# register user in CA for peers
361+
kubectl hlf ca register --name=org2-ca --user=peer --secret=peerpw --type=peer \
362+
--enroll-id enroll --enroll-secret=enrollpw --mspid Org2MSP
363+
364+
```
365+
366+
### Deploy a peer
367+
368+
```bash
369+
kubectl hlf peer create --statedb=leveldb --image=$PEER_IMAGE --version=$PEER_VERSION --storage-class=$SC_NAME --enroll-id=peer --mspid=Org2MSP \
370+
--enroll-pw=peerpw --capacity=5Gi --name=org2-peer0 --ca-name=org2-ca.default \
371+
--hosts=peer0-org2.localho.st --istio-port=443
372+
373+
374+
kubectl wait --timeout=180s --for=condition=Running fabricpeers.hlf.kungfusoftware.es --all
375+
```
376+
377+
Check that the peer is deployed and works:
378+
379+
```bash
380+
openssl s_client -connect peer0-org2.localho.st:443
342381
```
343382

344383
## Deploy an `Orderer` organization
@@ -376,6 +415,7 @@ kubectl hlf ca register --name=ord-ca --user=orderer --secret=ordererpw \
376415
### Deploy orderer
377416

378417
```bash
418+
379419
kubectl hlf ordnode create --image=$ORDERER_IMAGE --version=$ORDERER_VERSION \
380420
--storage-class=$SC_NAME --enroll-id=orderer --mspid=OrdererMSP \
381421
--enroll-pw=ordererpw --capacity=2Gi --name=ord-node1 --ca-name=ord-ca.default \
@@ -394,6 +434,12 @@ kubectl hlf ordnode create --image=$ORDERER_IMAGE --version=$ORDERER_VERSION \
394434
--hosts=orderer2-ord.localho.st --admin-hosts=admin-orderer2-ord.localho.st --istio-port=443
395435

396436

437+
kubectl hlf ordnode create --image=$ORDERER_IMAGE --version=$ORDERER_VERSION \
438+
--storage-class=$SC_NAME --enroll-id=orderer --mspid=OrdererMSP \
439+
--enroll-pw=ordererpw --capacity=2Gi --name=ord-node4 --ca-name=ord-ca.default \
440+
--hosts=orderer3-ord.localho.st --admin-hosts=admin-orderer3-ord.localho.st --istio-port=443
441+
442+
397443

398444
kubectl wait --timeout=180s --for=condition=Running fabricorderernodes.hlf.kungfusoftware.es --all
399445
```
@@ -406,6 +452,9 @@ kubectl get pods
406452

407453
```bash
408454
openssl s_client -connect orderer0-ord.localho.st:443
455+
openssl s_client -connect orderer1-ord.localho.st:443
456+
openssl s_client -connect orderer2-ord.localho.st:443
457+
openssl s_client -connect orderer3-ord.localho.st:443
409458
```
410459

411460

@@ -466,15 +515,36 @@ kubectl hlf identity create --name org1-admin --namespace default \
466515

467516
```
468517

469-
### Create the secret
518+
519+
### Register and enrolling Org2MSP identity
470520

471521
```bash
522+
# register
523+
kubectl hlf ca register --name=org2-ca --namespace=default --user=admin --secret=adminpw \
524+
--type=admin --enroll-id enroll --enroll-secret=enrollpw --mspid=Org2MSP
525+
526+
# enroll
527+
kubectl hlf ca enroll --name=org2-ca --namespace=default \
528+
--user=admin --secret=adminpw --mspid Org2MSP \
529+
--ca-name ca --output org2msp.yaml
530+
531+
# enroll
532+
kubectl hlf identity create --name org2-admin --namespace default \
533+
--ca-name org2-ca --ca-namespace default \
534+
--ca ca --mspid Org2MSP --enroll-id admin --enroll-secret adminpw
535+
536+
537+
```
472538

539+
### Create the secret
540+
541+
```bash
473542
kubectl create secret generic wallet --namespace=default \
474543
--from-file=org1msp.yaml=$PWD/org1msp.yaml \
475544
--from-file=org2msp.yaml=$PWD/org2msp.yaml \
476545
--from-file=orderermsp.yaml=$PWD/orderermsp.yaml \
477546
--from-file=orderermspsign.yaml=$PWD/orderermspsign.yaml
547+
478548
```
479549

480550
### Create main channel
@@ -491,6 +561,7 @@ export ORDERER_TLS_CERT=$(kubectl get fabriccas ord-ca -o=jsonpath='{.status.tls
491561
export ORDERER0_TLS_CERT=$(kubectl get fabricorderernodes ord-node1 -o=jsonpath='{.status.tlsCert}' | sed -e "s/^/${IDENT_8}/" )
492562
export ORDERER1_TLS_CERT=$(kubectl get fabricorderernodes ord-node2 -o=jsonpath='{.status.tlsCert}' | sed -e "s/^/${IDENT_8}/" )
493563
export ORDERER2_TLS_CERT=$(kubectl get fabricorderernodes ord-node3 -o=jsonpath='{.status.tlsCert}' | sed -e "s/^/${IDENT_8}/" )
564+
export ORDERER3_TLS_CERT=$(kubectl get fabricorderernodes ord-node4 -o=jsonpath='{.status.tlsCert}' | sed -e "s/^/${IDENT_8}/" )
494565

495566
kubectl apply -f - <<EOF
496567
apiVersion: hlf.kungfusoftware.es/v1alpha1
@@ -508,6 +579,7 @@ spec:
508579
acls: null
509580
capabilities:
510581
- V2_0
582+
- V2_5
511583
policies: null
512584
capabilities:
513585
- V2_0
@@ -571,11 +643,14 @@ spec:
571643
port: 7053
572644
- host: ord-node3.default
573645
port: 7053
646+
- host: ord-node4.default
647+
port: 7053
574648
mspID: OrdererMSP
575649
ordererEndpoints:
576650
- orderer0-ord.localho.st:443
577651
- orderer1-ord.localho.st:443
578652
- orderer2-ord.localho.st:443
653+
- orderer3-ord.localho.st:443
579654
orderersToJoin: []
580655
orderers:
581656
- host: orderer0-ord.localho.st
@@ -590,6 +665,10 @@ ${ORDERER1_TLS_CERT}
590665
port: 443
591666
tlsCert: |-
592667
${ORDERER2_TLS_CERT}
668+
- host: orderer3-ord.localho.st
669+
port: 443
670+
tlsCert: |-
671+
${ORDERER3_TLS_CERT}
593672
594673
EOF
595674

@@ -631,6 +710,42 @@ EOF
631710
```
632711

633712

713+
## Join peer to the channel
714+
715+
```bash
716+
717+
export IDENT_8=$(printf "%8s" "")
718+
export ORDERER0_TLS_CERT=$(kubectl get fabricorderernodes ord-node1 -o=jsonpath='{.status.tlsCert}' | sed -e "s/^/${IDENT_8}/" )
719+
720+
kubectl apply -f - <<EOF
721+
apiVersion: hlf.kungfusoftware.es/v1alpha1
722+
kind: FabricFollowerChannel
723+
metadata:
724+
name: demo-org2msp
725+
spec:
726+
anchorPeers:
727+
- host: peer0-org2.localho.st
728+
port: 443
729+
hlfIdentity:
730+
secretKey: org2msp.yaml
731+
secretName: wallet
732+
secretNamespace: default
733+
mspId: Org2MSP
734+
name: demo
735+
externalPeersToJoin: []
736+
orderers:
737+
- certificate: |
738+
${ORDERER0_TLS_CERT}
739+
url: grpcs://ord-node1.default:7050
740+
peersToJoin:
741+
- name: org2-peer0
742+
namespace: default
743+
EOF
744+
745+
746+
```
747+
748+
634749

635750
## Install a chaincode
636751

api/hlf.kungfusoftware.es/v1alpha1/hlf_types.go

Lines changed: 90 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,24 +2411,96 @@ type FabricMainChannelOrdererConfig struct {
24112411
}
24122412

24132413
type FabricMainChannelSmartBFT struct {
2414-
RequestBatchMaxCount uint64 `json:"request_batch_max_count,omitempty"`
2415-
RequestBatchMaxBytes uint64 `json:"request_batch_max_bytes,omitempty"`
2416-
RequestBatchMaxInterval string `json:"request_batch_max_interval,omitempty"`
2417-
IncomingMessageBufferSize uint64 `json:"incoming_message_buffer_size,omitempty"`
2418-
RequestPoolSize uint64 `json:"request_pool_size,omitempty"`
2419-
RequestForwardTimeout string `json:"request_forward_timeout,omitempty"`
2420-
RequestComplainTimeout string `json:"request_complain_timeout,omitempty"`
2421-
RequestAutoRemoveTimeout string `json:"request_auto_remove_timeout,omitempty"`
2422-
RequestMaxBytes uint64 `json:"request_max_bytes,omitempty"`
2423-
ViewChangeResendInterval string `json:"view_change_resend_interval,omitempty"`
2424-
ViewChangeTimeout string `json:"view_change_timeout,omitempty"`
2425-
LeaderHeartbeatTimeout string `json:"leader_heartbeat_timeout,omitempty"`
2426-
LeaderHeartbeatCount uint64 `json:"leader_heartbeat_count,omitempty"`
2427-
CollectTimeout string `json:"collect_timeout,omitempty"`
2428-
SyncOnStart bool `json:"sync_on_start,omitempty"`
2429-
SpeedUpViewChange bool `json:"speed_up_view_change,omitempty"`
2430-
LeaderRotation sb.Options_Rotation `json:"leader_rotation,omitempty"`
2431-
DecisionsPerLeader uint64 `json:"decisions_per_leader,omitempty"`
2414+
// +nullable
2415+
// +optional
2416+
// +kubebuilder:validation:Optional
2417+
// +kubebuilder:default:=100
2418+
RequestBatchMaxCount uint64 `json:"request_batch_max_count,omitempty"`
2419+
// +nullable
2420+
// +optional
2421+
// +kubebuilder:validation:Optional
2422+
// +kubebuilder:default:=10485760
2423+
RequestBatchMaxBytes uint64 `json:"request_batch_max_bytes,omitempty"`
2424+
// +nullable
2425+
// +optional
2426+
// +kubebuilder:validation:Optional
2427+
// +kubebuilder:default:="50ms"
2428+
RequestBatchMaxInterval string `json:"request_batch_max_interval,omitempty"`
2429+
// +nullable
2430+
// +optional
2431+
// +kubebuilder:validation:Optional
2432+
// +kubebuilder:default:=200
2433+
IncomingMessageBufferSize uint64 `json:"incoming_message_buffer_size,omitempty"`
2434+
// +nullable
2435+
// +optional
2436+
// +kubebuilder:validation:Optional
2437+
// +kubebuilder:default:=400
2438+
RequestPoolSize uint64 `json:"request_pool_size,omitempty"`
2439+
// +nullable
2440+
// +optional
2441+
// +kubebuilder:validation:Optional
2442+
// +kubebuilder:default:="2s"
2443+
RequestForwardTimeout string `json:"request_forward_timeout,omitempty"`
2444+
// +nullable
2445+
// +optional
2446+
// +kubebuilder:validation:Optional
2447+
// +kubebuilder:default:="20s"
2448+
RequestComplainTimeout string `json:"request_complain_timeout,omitempty"`
2449+
// +nullable
2450+
// +optional
2451+
// +kubebuilder:validation:Optional
2452+
// +kubebuilder:default:="3m"
2453+
RequestAutoRemoveTimeout string `json:"request_auto_remove_timeout,omitempty"`
2454+
// +nullable
2455+
// +optional
2456+
// +kubebuilder:validation:Optional
2457+
// +kubebuilder:default:=10485760
2458+
RequestMaxBytes uint64 `json:"request_max_bytes,omitempty"`
2459+
// +nullable
2460+
// +optional
2461+
// +kubebuilder:validation:Optional
2462+
// +kubebuilder:default:="5s"
2463+
ViewChangeResendInterval string `json:"view_change_resend_interval,omitempty"`
2464+
// +nullable
2465+
// +optional
2466+
// +kubebuilder:validation:Optional
2467+
// +kubebuilder:default:="20s"
2468+
ViewChangeTimeout string `json:"view_change_timeout,omitempty"`
2469+
// +nullable
2470+
// +optional
2471+
// +kubebuilder:validation:Optional
2472+
// +kubebuilder:default:="1m"
2473+
LeaderHeartbeatTimeout string `json:"leader_heartbeat_timeout,omitempty"`
2474+
// +nullable
2475+
// +optional
2476+
// +kubebuilder:validation:Optional
2477+
// +kubebuilder:default:=10
2478+
LeaderHeartbeatCount uint64 `json:"leader_heartbeat_count,omitempty"`
2479+
// +nullable
2480+
// +optional
2481+
// +kubebuilder:validation:Optional
2482+
// +kubebuilder:default:="1s"
2483+
CollectTimeout string `json:"collect_timeout,omitempty"`
2484+
// +nullable
2485+
// +optional
2486+
// +kubebuilder:validation:Optional
2487+
// +kubebuilder:default:=false
2488+
SyncOnStart bool `json:"sync_on_start,omitempty"`
2489+
// +nullable
2490+
// +optional
2491+
// +kubebuilder:validation:Optional
2492+
// +kubebuilder:default:=false
2493+
SpeedUpViewChange bool `json:"speed_up_view_change,omitempty"`
2494+
// +nullable
2495+
// +optional
2496+
// +kubebuilder:validation:Optional
2497+
// +kubebuilder:default:=1
2498+
LeaderRotation sb.Options_Rotation `json:"leader_rotation,omitempty"`
2499+
// +nullable
2500+
// +optional
2501+
// +kubebuilder:validation:Optional
2502+
// +kubebuilder:default:=3
2503+
DecisionsPerLeader uint64 `json:"decisions_per_leader,omitempty"`
24322504
}
24332505
type FabricMainChannelEtcdRaft struct {
24342506
// +nullable

0 commit comments

Comments
 (0)