Skip to content

Instantly share code, notes, and snippets.

@kctam
kctam / 3_rca_org1.sh
Created July 10, 2020 00:22
Companion Guide for Fabric CA Operation Guide - script
docker-compose up -d rca-org1
sleep 5
export FABRIC_CA_CLIENT_TLS_CERTFILES=/tmp/hyperledger/org1/ca/crypto/ca-cert.pem
export FABRIC_CA_CLIENT_HOME=/tmp/hyperledger/org1/ca/admin
fabric-ca-client enroll -d -u https://rca-org1-admin:rca-org1-adminpw@0.0.0.0:7054
sleep 5
fabric-ca-client register -d --id.name peer1-org1 --id.secret peer1PW --id.type peer -u https://0.0.0.0:7054
@kctam
kctam / 2_rca-org0.sh
Created July 10, 2020 00:18
Companion Guide for Fabric CA Operation Guide - script
docker-compose up -d rca-org0
sleep 5
export FABRIC_CA_CLIENT_TLS_CERTFILES=/tmp/hyperledger/org0/ca/crypto/ca-cert.pem
export FABRIC_CA_CLIENT_HOME=/tmp/hyperledger/org0/ca/admin
fabric-ca-client enroll -d -u https://rca-org0-admin:rca-org0-adminpw@0.0.0.0:7053
sleep 5
fabric-ca-client register -d --id.name orderer1-org0 --id.secret ordererpw --id.type orderer -u https://0.0.0.0:7053
@kctam
kctam / 1_ca-tls.sh
Created July 10, 2020 00:09
Companion Guide for Fabric CA Operation Guide - script
docker-compose up -d ca-tls
sleep 5
export FABRIC_CA_CLIENT_TLS_CERTFILES=/tmp/hyperledger/tls-ca/crypto/tls-cert.pem
export FABRIC_CA_CLIENT_HOME=/tmp/hyperledger/tls-ca/admin
fabric-ca-client enroll -d -u https://tls-ca-admin:tls-ca-adminpw@0.0.0.0:7052
sleep 5
fabric-ca-client register -d --id.name peer1-org1 --id.secret peer1PW --id.type peer -u https://0.0.0.0:7052
@kctam
kctam / configtx.yaml
Created July 9, 2020 09:35
Companion Guide for Fabric CA Operation Guide (modified from origin)
################################################################################
#
# Section: Organizations
#
# - This section defines the different organizational identities which will
# be referenced later in the configuration.
#
################################################################################
Organizations:
@kctam
kctam / docker-compose.yaml
Created July 9, 2020 09:31
Companion Guide for Fabric CA Operations Guide (modified from origin)
version: '2'
networks:
fabric-ca:
services:
ca-tls:
container_name: ca-tls
image: hyperledger/fabric-ca:1.4.2
command: sh -c 'fabric-ca-server start -d -b tls-ca-admin:tls-ca-adminpw --port 7052'
@kctam
kctam / testblocktime.go
Created June 18, 2020 03:27
A testing chaincode to show what happens if more than a transaction acting on a state in a block cycle
package main
import (
"fmt"
"strconv"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
@kctam
kctam / sacc.go
Last active April 20, 2020 05:43
sacc.go with private data using implicit private data collection and access control with CID
/*
* Copyright IBM Corp All Rights Reserved
*
* SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"fmt"
@kctam
kctam / docker-compose-orderercli.yaml
Created March 20, 2020 03:14
For orderer-cli container
version: '2'
networks:
byfn:
services:
orderer-cli:
container_name: orderer-cli
image: hyperledger/fabric-tools:$IMAGE_TAG
@kctam
kctam / docker-compose-orderer6.yaml
Created March 20, 2020 03:13
For orderer6 container
version: '2'
volumes:
orderer6.example.com:
networks:
byfn:
services:
@kctam
kctam / 8_addEndPointAppCh.sh
Created March 20, 2020 03:06
Add End Point to Application Channel
docker exec orderer-cli sh -c 'peer channel fetch config config_block.pb -o orderer.example.com:7050 -c mychannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem'
docker exec orderer-cli sh -c 'configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config > config.json'
docker exec orderer-cli sh -c 'jq ".channel_group.values.OrdererAddresses.value.addresses += [\"orderer6.example.com:7050\"]" config.json > modified_config.json'
docker exec orderer-cli sh -c 'configtxlator proto_encode --input config.json --type common.Config --output config.pb'
docker exec orderer-cli sh -c 'configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb'
docker exec orderer-cli sh -c 'configtxlator compute_update --channel_id mychannel --original config.pb --updated modified_config.pb --output config_update.pb