Skip to content

Commit

Permalink
Update mainchannel
Browse files Browse the repository at this point in the history
Signed-off-by: David VIEJO <[email protected]>
  • Loading branch information
dviejokfs committed Aug 19, 2024
1 parent 610ce76 commit 9462fc5
Show file tree
Hide file tree
Showing 9 changed files with 465 additions and 56 deletions.
129 changes: 122 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ This workshop provides an in-depth, hands-on discussion and demonstration of usi

| | |
|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ![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 |
| ![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 |
| ![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) |

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


kubectl hlf peer create --statedb=leveldb --image=$PEER_IMAGE --version=$PEER_VERSION --storage-class=$SC_NAME --enroll-id=peer --mspid=Org1MSP \
--enroll-pw=peerpw --capacity=5Gi --name=org1-peer1 --ca-name=org1-ca.default \
--hosts=peer1-org1.localho.st --istio-port=443

kubectl wait --timeout=180s --for=condition=Running fabricpeers.hlf.kungfusoftware.es --all
```

Check that the peer is deployed and works:

```bash
openssl s_client -connect peer0-org1.localho.st:443
openssl s_client -connect peer1-org1.localho.st:443
```


## Deploy Org2

### Deploy a certificate authority

```bash
kubectl hlf ca create --image=$CA_IMAGE --version=$CA_VERSION --storage-class=$SC_NAME --capacity=1Gi --name=org2-ca \
--enroll-id=enroll --enroll-pw=enrollpw --hosts=org2-ca.localho.st --istio-port=443

kubectl wait --timeout=180s --for=condition=Running fabriccas.hlf.kungfusoftware.es --all
```

Check that the certification authority is deployed and works:

```bash
curl -k https://org2-ca.localho.st:443/cainfo
```

Register a user in the certification authority of the peer organization (Org2MSP)

```bash
# register user in CA for peers
kubectl hlf ca register --name=org2-ca --user=peer --secret=peerpw --type=peer \
--enroll-id enroll --enroll-secret=enrollpw --mspid Org2MSP

```

### Deploy a peer

```bash
kubectl hlf peer create --statedb=leveldb --image=$PEER_IMAGE --version=$PEER_VERSION --storage-class=$SC_NAME --enroll-id=peer --mspid=Org2MSP \
--enroll-pw=peerpw --capacity=5Gi --name=org2-peer0 --ca-name=org2-ca.default \
--hosts=peer0-org2.localho.st --istio-port=443


kubectl wait --timeout=180s --for=condition=Running fabricpeers.hlf.kungfusoftware.es --all
```

Check that the peer is deployed and works:

```bash
openssl s_client -connect peer0-org2.localho.st:443
```

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

```bash

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


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



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

```bash
openssl s_client -connect orderer0-ord.localho.st:443
openssl s_client -connect orderer1-ord.localho.st:443
openssl s_client -connect orderer2-ord.localho.st:443
openssl s_client -connect orderer3-ord.localho.st:443
```


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

```

### Create the secret

### Register and enrolling Org2MSP identity

```bash
# register
kubectl hlf ca register --name=org2-ca --namespace=default --user=admin --secret=adminpw \
--type=admin --enroll-id enroll --enroll-secret=enrollpw --mspid=Org2MSP

# enroll
kubectl hlf ca enroll --name=org2-ca --namespace=default \
--user=admin --secret=adminpw --mspid Org2MSP \
--ca-name ca --output org2msp.yaml

# enroll
kubectl hlf identity create --name org2-admin --namespace default \
--ca-name org2-ca --ca-namespace default \
--ca ca --mspid Org2MSP --enroll-id admin --enroll-secret adminpw


```

### Create the secret

```bash
kubectl create secret generic wallet --namespace=default \
--from-file=org1msp.yaml=$PWD/org1msp.yaml \
--from-file=org2msp.yaml=$PWD/org2msp.yaml \
--from-file=orderermsp.yaml=$PWD/orderermsp.yaml \
--from-file=orderermspsign.yaml=$PWD/orderermspsign.yaml

```

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

kubectl apply -f - <<EOF
apiVersion: hlf.kungfusoftware.es/v1alpha1
Expand All @@ -508,6 +579,7 @@ spec:
acls: null
capabilities:
- V2_0
- V2_5
policies: null
capabilities:
- V2_0
Expand Down Expand Up @@ -571,11 +643,14 @@ spec:
port: 7053
- host: ord-node3.default
port: 7053
- host: ord-node4.default
port: 7053
mspID: OrdererMSP
ordererEndpoints:
- orderer0-ord.localho.st:443
- orderer1-ord.localho.st:443
- orderer2-ord.localho.st:443
- orderer3-ord.localho.st:443
orderersToJoin: []
orderers:
- host: orderer0-ord.localho.st
Expand All @@ -590,6 +665,10 @@ ${ORDERER1_TLS_CERT}
port: 443
tlsCert: |-
${ORDERER2_TLS_CERT}
- host: orderer3-ord.localho.st
port: 443
tlsCert: |-
${ORDERER3_TLS_CERT}
EOF

Expand Down Expand Up @@ -631,6 +710,42 @@ EOF
```


## Join peer to the channel

```bash

export IDENT_8=$(printf "%8s" "")
export ORDERER0_TLS_CERT=$(kubectl get fabricorderernodes ord-node1 -o=jsonpath='{.status.tlsCert}' | sed -e "s/^/${IDENT_8}/" )

kubectl apply -f - <<EOF
apiVersion: hlf.kungfusoftware.es/v1alpha1
kind: FabricFollowerChannel
metadata:
name: demo-org2msp
spec:
anchorPeers:
- host: peer0-org2.localho.st
port: 443
hlfIdentity:
secretKey: org2msp.yaml
secretName: wallet
secretNamespace: default
mspId: Org2MSP
name: demo
externalPeersToJoin: []
orderers:
- certificate: |
${ORDERER0_TLS_CERT}
url: grpcs://ord-node1.default:7050
peersToJoin:
- name: org2-peer0
namespace: default
EOF


```



## Install a chaincode

Expand Down
108 changes: 90 additions & 18 deletions api/hlf.kungfusoftware.es/v1alpha1/hlf_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2411,24 +2411,96 @@ type FabricMainChannelOrdererConfig struct {
}

type FabricMainChannelSmartBFT struct {
RequestBatchMaxCount uint64 `json:"request_batch_max_count,omitempty"`
RequestBatchMaxBytes uint64 `json:"request_batch_max_bytes,omitempty"`
RequestBatchMaxInterval string `json:"request_batch_max_interval,omitempty"`
IncomingMessageBufferSize uint64 `json:"incoming_message_buffer_size,omitempty"`
RequestPoolSize uint64 `json:"request_pool_size,omitempty"`
RequestForwardTimeout string `json:"request_forward_timeout,omitempty"`
RequestComplainTimeout string `json:"request_complain_timeout,omitempty"`
RequestAutoRemoveTimeout string `json:"request_auto_remove_timeout,omitempty"`
RequestMaxBytes uint64 `json:"request_max_bytes,omitempty"`
ViewChangeResendInterval string `json:"view_change_resend_interval,omitempty"`
ViewChangeTimeout string `json:"view_change_timeout,omitempty"`
LeaderHeartbeatTimeout string `json:"leader_heartbeat_timeout,omitempty"`
LeaderHeartbeatCount uint64 `json:"leader_heartbeat_count,omitempty"`
CollectTimeout string `json:"collect_timeout,omitempty"`
SyncOnStart bool `json:"sync_on_start,omitempty"`
SpeedUpViewChange bool `json:"speed_up_view_change,omitempty"`
LeaderRotation sb.Options_Rotation `json:"leader_rotation,omitempty"`
DecisionsPerLeader uint64 `json:"decisions_per_leader,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=100
RequestBatchMaxCount uint64 `json:"request_batch_max_count,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=10485760
RequestBatchMaxBytes uint64 `json:"request_batch_max_bytes,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="50ms"
RequestBatchMaxInterval string `json:"request_batch_max_interval,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=200
IncomingMessageBufferSize uint64 `json:"incoming_message_buffer_size,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=400
RequestPoolSize uint64 `json:"request_pool_size,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="2s"
RequestForwardTimeout string `json:"request_forward_timeout,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="20s"
RequestComplainTimeout string `json:"request_complain_timeout,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="3m"
RequestAutoRemoveTimeout string `json:"request_auto_remove_timeout,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=10485760
RequestMaxBytes uint64 `json:"request_max_bytes,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="5s"
ViewChangeResendInterval string `json:"view_change_resend_interval,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="20s"
ViewChangeTimeout string `json:"view_change_timeout,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="1m"
LeaderHeartbeatTimeout string `json:"leader_heartbeat_timeout,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=10
LeaderHeartbeatCount uint64 `json:"leader_heartbeat_count,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="1s"
CollectTimeout string `json:"collect_timeout,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=false
SyncOnStart bool `json:"sync_on_start,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=false
SpeedUpViewChange bool `json:"speed_up_view_change,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=1
LeaderRotation sb.Options_Rotation `json:"leader_rotation,omitempty"`
// +nullable
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:=3
DecisionsPerLeader uint64 `json:"decisions_per_leader,omitempty"`
}
type FabricMainChannelEtcdRaft struct {
// +nullable
Expand Down
Loading

0 comments on commit 9462fc5

Please sign in to comment.