Skip to content

Instantly share code, notes, and snippets.

@sykesm
Created April 4, 2018 20:23
Show Gist options
  • Save sykesm/aaa9a5121a13888a8c44644a5a840382 to your computer and use it in GitHub Desktop.
Save sykesm/aaa9a5121a13888a8c44644a5a840382 to your computer and use it in GitHub Desktop.
testdata
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package simple
import (
"fmt"
"strconv"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
// SimpleChaincode example simple Chaincode implementation
type SimpleChaincode struct {
}
func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
fmt.Println("Init invoked")
_, args := stub.GetFunctionAndParameters()
var A, B string // Entities
var Aval, Bval int // Asset holdings
var err error
if len(args) != 4 {
return shim.Error("Incorrect number of arguments. Expecting 4")
}
// Initialize the chaincode
A = args[0]
Aval, err = strconv.Atoi(args[1])
if err != nil {
return shim.Error("Expecting integer value for asset holding")
}
B = args[2]
Bval, err = strconv.Atoi(args[3])
if err != nil {
return shim.Error("Expecting integer value for asset holding")
}
fmt.Printf("Aval = %d, Bval = %d\n", Aval, Bval)
// Write the state to the ledger
err = stub.PutState(A, []byte(strconv.Itoa(Aval)))
if err != nil {
return shim.Error(err.Error())
}
err = stub.PutState(B, []byte(strconv.Itoa(Bval)))
if err != nil {
return shim.Error(err.Error())
}
fmt.Println("Init returning with success")
return shim.Success(nil)
}
func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
fmt.Println("ex02 Invoke")
function, args := stub.GetFunctionAndParameters()
if function == "invoke" {
// Make payment of X units from A to B
return t.invoke(stub, args)
} else if function == "delete" {
// Deletes an entity from its state
return t.delete(stub, args)
} else if function == "query" {
// the old "Query" is now implemtned in invoke
return t.query(stub, args)
}
return shim.Error("Invalid invoke function name. Expecting \"invoke\" \"delete\" \"query\"")
}
// Transaction makes payment of X units from A to B
func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {
var A, B string // Entities
var Aval, Bval int // Asset holdings
var X int // Transaction value
var err error
if len(args) != 3 {
return shim.Error("Incorrect number of arguments. Expecting 3")
}
A = args[0]
B = args[1]
// Get the state from the ledger
// TODO: will be nice to have a GetAllState call to ledger
Avalbytes, err := stub.GetState(A)
if err != nil {
return shim.Error("Failed to get state")
}
if Avalbytes == nil {
return shim.Error("Entity not found")
}
Aval, _ = strconv.Atoi(string(Avalbytes))
Bvalbytes, err := stub.GetState(B)
if err != nil {
return shim.Error("Failed to get state")
}
if Bvalbytes == nil {
return shim.Error("Entity not found")
}
Bval, _ = strconv.Atoi(string(Bvalbytes))
// Perform the execution
X, err = strconv.Atoi(args[2])
if err != nil {
return shim.Error("Invalid transaction amount, expecting a integer value")
}
Aval = Aval - X
Bval = Bval + X
fmt.Printf("Aval = %d, Bval = %d\n", Aval, Bval)
// Write the state back to the ledger
err = stub.PutState(A, []byte(strconv.Itoa(Aval)))
if err != nil {
return shim.Error(err.Error())
}
err = stub.PutState(B, []byte(strconv.Itoa(Bval)))
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(nil)
}
// Deletes an entity from state
func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
}
A := args[0]
// Delete the key from the state in ledger
err := stub.DelState(A)
if err != nil {
return shim.Error("Failed to delete state")
}
return shim.Success(nil)
}
// query callback representing the query of a chaincode
func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {
var A string // Entities
var err error
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting name of the person to query")
}
A = args[0]
// Get the state from the ledger
Avalbytes, err := stub.GetState(A)
if err != nil {
jsonResp := "{\"Error\":\"Failed to get state for " + A + "\"}"
return shim.Error(jsonResp)
}
if Avalbytes == nil {
jsonResp := "{\"Error\":\"Nil amount for " + A + "\"}"
return shim.Error(jsonResp)
}
jsonResp := "{\"Name\":\"" + A + "\",\"Amount\":\"" + string(Avalbytes) + "\"}"
fmt.Printf("Query Response:%s\n", jsonResp)
return shim.Success(Avalbytes)
}
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
---
Profiles:
TwoOrgsOrdererGenesis:
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- *OrdererOrg
- *Org1
- *Org2
Capabilities:
<<: *ApplicationCapabilities
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
TwoOrgsChannel:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
Capabilities:
<<: *ApplicationCapabilities
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
#MSPDir: crypto/ordererOrganizations/example.com/msp
MSPDir: crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp
- &Org1
Name: Org1
ID: Org1MSP
#MSPDir: crypto/peerOrganizations/org1.example.com/msp
MSPDir: crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
AnchorPeers:
- Host: 0.0.0.0
Port: 10051
- &Org2
Name: Org2
ID: Org2MSP
#MSPDir: crypto/peerOrganizations/org2.example.com/msp
MSPDir: crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
AnchorPeers:
- Host: 0.0.0.0
Port: 11051
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- 0.0.0.0:7050
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 1
AbsoluteMaxBytes: 98 MB
PreferredMaxBytes: 512 KB
Kafka:
Brokers:
- kafka0:9092
- kafka1:9092
- kafka2:9092
- kafka3:9092
Organizations:
Application: &ApplicationDefaults
Organizations:
Capabilities:
Global: &ChannelCapabilities
V1_1: true
Orderer: &OrdererCapabilities
V1_1: true
Application: &ApplicationCapabilities
V1_2: true
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
###############################################################################
#
# LOGGING section
#
###############################################################################
logging:
# Default logging levels are specified here.
# Valid logging levels are case-insensitive strings chosen from
# CRITICAL | ERROR | WARNING | NOTICE | INFO | DEBUG
# The overall default logging level can be specified in various ways,
# listed below from strongest to weakest:
#
# 1. The --logging-level=<level> command line option overrides all other
# default specifications.
#
# 2. The environment variable CORE_LOGGING_LEVEL otherwise applies to
# all peer commands if defined as a non-empty string.
#
# 3. The value of `level` that directly follows in this file.
#
# If no overall default level is provided via any of the above methods,
# the peer will default to INFO (the value of defaultLevel in
# common/flogging/logging.go)
# Default for all modules running within the scope of a peer.
# Note: this value is only used when --logging-level or CORE_LOGGING_LEVEL
# are not set
level: info
# The overall default values mentioned above can be overridden for the
# specific components listed in the override section below.
# Override levels for various peer modules. These levels will be
# applied once the peer has completely started. They are applied at this
# time in order to be sure every logger has been registered with the
# logging package.
# Note: the modules listed below are the only acceptable modules at this
# time.
cauthdsl: warning
gossip: warning
grpc: error
ledger: info
msp: warning
policies: warning
peer:
gossip: warning
# Message format for the peer logs
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
###############################################################################
#
# Peer section
#
###############################################################################
peer:
# The Peer id is used for identifying this Peer instance.
id: jdoe
# The networkId allows for logical seperation of networks
networkId: dev
# The Address at local network interface this Peer will listen on.
# By default, it will listen on all network interfaces
listenAddress: 0.0.0.0:7051
# The endpoint this peer uses to listen for inbound chaincode connections.
# If this is commented-out, the listen address is selected to be
# the peer's address (see below) with port 7052
# chaincodeListenAddress: 0.0.0.0:7052
# The endpoint the chaincode for this peer uses to connect to the peer.
# If this is not specified, the chaincodeListenAddress address is selected.
# And if chaincodeListenAddress is not specified, address is selected from
# peer listenAddress.
# chaincodeAddress: 0.0.0.0:7052
# When used as peer config, this represents the endpoint to other peers
# in the same organization. For peers in other organization, see
# gossip.externalEndpoint for more info.
# When used as CLI config, this means the peer's endpoint to interact with
address: 0.0.0.0:7051
# Whether the Peer should programmatically determine its address
# This case is useful for docker containers.
addressAutoDetect: false
# Setting for runtime.GOMAXPROCS(n). If n < 1, it does not change the
# current setting
gomaxprocs: -1
# Keepalive settings for peer server and clients
keepalive:
# MinInterval is the minimum permitted time between client pings.
# If clients send pings more frequently, the peer server will
# disconnect them
minInterval: 60s
# Client keepalive settings for communicating with other peer nodes
client:
# Interval is the time between pings to peer nodes. This must
# greater than or equal to the minInterval specified by peer
# nodes
interval: 60s
# Timeout is the duration the client waits for a response from
# peer nodes before closing the connection
timeout: 20s
# DeliveryClient keepalive settings for communication with ordering
# nodes.
deliveryClient:
# Interval is the time between pings to ordering nodes. This must
# greater than or equal to the minInterval specified by ordering
# nodes.
interval: 60s
# Timeout is the duration the client waits for a response from
# ordering nodes before closing the connection
timeout: 20s
# Gossip related configuration
gossip:
# Bootstrap set to initialize gossip with.
# This is a list of other peers that this peer reaches out to at startup.
# Important: The endpoints here have to be endpoints of peers in the same
# organization, because the peer would refuse connecting to these endpoints
# unless they are in the same organization as the peer.
bootstrap: 127.0.0.1:7051
# NOTE: orgLeader and useLeaderElection parameters are mutual exclusive.
# Setting both to true would result in the termination of the peer
# since this is undefined state. If the peers are configured with
# useLeaderElection=false, make sure there is at least 1 peer in the
# organization that its orgLeader is set to true.
# Defines whenever peer will initialize dynamic algorithm for
# "leader" selection, where leader is the peer to establish
# connection with ordering service and use delivery protocol
# to pull ledger blocks from ordering service. It is recommended to
# use leader election for large networks of peers.
useLeaderElection: true
# Statically defines peer to be an organization "leader",
# where this means that current peer will maintain connection
# with ordering service and disseminate block across peers in
# its own organization
orgLeader: false
# Overrides the endpoint that the peer publishes to peers
# in its organization. For peers in foreign organizations
# see 'externalEndpoint'
endpoint:
# Maximum count of blocks stored in memory
maxBlockCountToStore: 100
# Max time between consecutive message pushes(unit: millisecond)
maxPropagationBurstLatency: 10ms
# Max number of messages stored until a push is triggered to remote peers
maxPropagationBurstSize: 10
# Number of times a message is pushed to remote peers
propagateIterations: 1
# Number of peers selected to push messages to
propagatePeerNum: 3
# Determines frequency of pull phases(unit: second)
pullInterval: 4s
# Number of peers to pull from
pullPeerNum: 3
# Determines frequency of pulling state info messages from peers(unit: second)
requestStateInfoInterval: 4s
# Determines frequency of pushing state info messages to peers(unit: second)
publishStateInfoInterval: 4s
# Maximum time a stateInfo message is kept until expired
stateInfoRetentionInterval:
# Time from startup certificates are included in Alive messages(unit: second)
publishCertPeriod: 10s
# Should we skip verifying block messages or not (currently not in use)
skipBlockVerification: false
# Dial timeout(unit: second)
dialTimeout: 3s
# Connection timeout(unit: second)
connTimeout: 2s
# Buffer size of received messages
recvBuffSize: 20
# Buffer size of sending messages
sendBuffSize: 200
# Time to wait before pull engine processes incoming digests (unit: second)
digestWaitTime: 1s
# Time to wait before pull engine removes incoming nonce (unit: second)
requestWaitTime: 1s
# Time to wait before pull engine ends pull (unit: second)
responseWaitTime: 2s
# Alive check interval(unit: second)
aliveTimeInterval: 5s
# Alive expiration timeout(unit: second)
aliveExpirationTimeout: 25s
# Reconnect interval(unit: second)
reconnectInterval: 25s
# This is an endpoint that is published to peers outside of the organization.
# If this isn't set, the peer will not be known to other organizations.
externalEndpoint:
# Leader election service configuration
election:
# Longest time peer waits for stable membership during leader election startup (unit: second)
startupGracePeriod: 15s
# Interval gossip membership samples to check its stability (unit: second)
membershipSampleInterval: 1s
# Time passes since last declaration message before peer decides to perform leader election (unit: second)
leaderAliveThreshold: 10s
# Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second)
leaderElectionDuration: 5s
pvtData:
# pullRetryThreshold determines the maximum duration of time private data corresponding for a given block
# would be attempted to be pulled from peers until the block would be committed without the private data
pullRetryThreshold: 60s
# As private data enters the transient store, it is associated with the peer's ledger's height at that time.
# transientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit,
# and the private data residing inside the transient store that is guaranteed not to be purged.
# Private data is purged from the transient store when blocks with sequences that are multiples
# of transientstoreMaxBlockRetention are committed.
transientstoreMaxBlockRetention: 1000
# pushAckTimeout is the maximum time to wait for an acknowledgement from each peer
# at private data push at endorsement time.
pushAckTimeout: 3s
# EventHub related configuration
events:
# The address that the Event service will be enabled on the peer
address: 0.0.0.0:7053
# total number of events that could be buffered without blocking send
buffersize: 100
# timeout duration for producer to send an event.
# if < 0, if buffer full, unblocks immediately and not send
# if 0, if buffer full, will block and guarantee the event will be sent out
# if > 0, if buffer full, blocks till timeout
timeout: 10ms
# timewindow is the acceptable difference between the peer's current
# time and the client's time as specified in a registration event
timewindow: 15m
# Keepalive settings for peer server and clients
keepalive:
# MinInterval is the minimum permitted time in seconds which clients
# can send keepalive pings. If clients send pings more frequently,
# the events server will disconnect them
minInterval: 60s
# TLS Settings
# Note that peer-chaincode connections through chaincodeListenAddress is
# not mutual TLS auth. See comments on chaincodeListenAddress for more info
tls:
# Require server-side TLS
enabled: false
# Require client certificates / mutual TLS.
# Note that clients that are not configured to use a certificate will
# fail to connect to the peer.
clientAuthRequired: false
# X.509 certificate used for TLS server
cert:
file: tls/server.crt
# Private key used for TLS server (and client if clientAuthEnabled
# is set to true
key:
file: tls/server.key
# Trusted root certificate chain for tls.cert
rootcert:
file: tls/ca.crt
# Set of root certificate authorities used to verify client certificates
clientRootCAs:
files:
- tls/ca.crt
# Private key used for TLS when making client connections. If
# not set, peer.tls.key.file will be used instead
clientKey:
file:
# X.509 certificate used for TLS when making client connections.
# If not set, peer.tls.cert.file will be used instead
clientCert:
file:
# Authentication contains configuration parameters related to authenticating
# client messages
authentication:
# the acceptable difference between the current server time and the
# client's time as specified in a client request message
timewindow: 15m
# Path on the file system where peer will store data (eg ledger). This
# location must be access control protected to prevent unintended
# modification that might corrupt the peer operations.
fileSystemPath: /var/hyperledger/production
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of Key Store
FileKeyStore:
# If "", defaults to 'mspConfigPath'/keystore
# TODO: Ensure this is read with fabric/core/config.GetPath() once ready
KeyStore:
# Path on the file system where peer will find MSP local configurations
mspConfigPath: msp
# Identifier of the local MSP
# ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!----
# Deployers need to change the value of the localMspId string.
# In particular, the name of the local MSP ID of a peer needs
# to match the name of one of the MSPs in each of the channel
# that this peer is a member of. Otherwise this peer's messages
# will not be identified as valid by other nodes.
localMspId: SampleOrg
# Delivery service related config
deliveryclient:
# It sets the total time the delivery service may spend in reconnection
# attempts until its retry logic gives up and returns an error
reconnectTotalTimeThreshold: 3600s
# Type for the local MSP - by default it's of type bccsp
localMspType: bccsp
# Used with Go profiling tools only in none production environment. In
# production, it should be disabled (eg enabled: false)
profile:
enabled: false
listenAddress: 0.0.0.0:6060
# The admin service is used for administrative operations such as
# control over log module severity, etc.
# Only peer administrators can use the service.
adminService:
# The interface and port on which the admin server will listen on.
# If this is commented out, or the port number is equal to the port
# of the peer listen address - the admin service is attached to the
# peer's service (defaults to 7051).
#listenAddress: 0.0.0.0:7055
# Handlers defines custom handlers that can filter and mutate
# objects passing within the peer, such as:
# Auth filter - reject or forward proposals from clients
# Decorators - append or mutate the chaincode input passed to the chaincode
# Valid handler definition contains:
# - A name which is a factory method name defined in
# core/handlers/library/library.go for statically compiled handlers
# - library path to shared object binary for pluggable filters
# Auth filters and decorators are chained and executed in the order that
# they are defined. For example:
# authFilters:
# -
# name: FilterOne
# library: /opt/lib/filter.so
# -
# name: FilterTwo
# decorators:
# -
# name: DecoratorOne
# -
# name: DecoratorTwo
# library: /opt/lib/decorator.so
handlers:
authFilters:
-
name: DefaultAuth
-
name: ExpirationCheck # This filter checks identity x509 certificate expiration
decorators:
-
name: DefaultDecorator
# Number of goroutines that will execute transaction validation in parallel.
# By default, the peer chooses the number of CPUs on the machine. Set this
# variable to override that choice.
# NOTE: overriding this value might negatively influence the performance of
# the peer so please change this value only if you know what you're doing
validatorPoolSize:
###############################################################################
#
# VM section
#
###############################################################################
vm:
# Endpoint of the vm management system. For docker can be one of the following in general
# unix:///var/run/docker.sock
# http://localhost:2375
# https://localhost:2376
endpoint: unix:///var/run/docker.sock
# settings for docker vms
docker:
tls:
enabled: false
ca:
file: docker/ca.crt
cert:
file: docker/tls.crt
key:
file: docker/tls.key
# Enables/disables the standard out/err from chaincode containers for
# debugging purposes
attachStdout: false
# Parameters on creating docker container.
# Container may be efficiently created using ipam & dns-server for cluster
# NetworkMode - sets the networking mode for the container. Supported
# standard values are: `host`(default),`bridge`,`ipvlan`,`none`.
# Dns - a list of DNS servers for the container to use.
# Note: `Privileged` `Binds` `Links` and `PortBindings` properties of
# Docker Host Config are not supported and will not be used if set.
# LogConfig - sets the logging driver (Type) and related options
# (Config) for Docker. For more info,
# https://docs.docker.com/engine/admin/logging/overview/
# Note: Set LogConfig using Environment Variables is not supported.
hostConfig:
NetworkMode: host
Dns:
# - 192.168.0.1
LogConfig:
Type: json-file
Config:
max-size: "50m"
max-file: "5"
Memory: 2147483648
###############################################################################
#
# Chaincode section
#
###############################################################################
chaincode:
# The id is used by the Chaincode stub to register the executing Chaincode
# ID with the Peer and is generally supplied through ENV variables
# the `path` form of ID is provided when installing the chaincode.
# The `name` is used for all other requests and can be any string.
id:
path:
name:
# Generic builder environment, suitable for most chaincode types
builder: $(DOCKER_NS)/fabric-ccenv:$(ARCH)-$(PROJECT_VERSION)
# Enables/disables force pulling of the base docker images (listed below)
# during user chaincode instantiation.
# Useful when using moving image tags (such as :latest)
pull: false
golang:
# golang will never need more than baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
# whether or not golang chaincode should be linked dynamically
dynamicLink: false
car:
# car may need more facilities (JVM, etc) in the future as the catalog
# of platforms are expanded. For now, we can just use baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
java:
# This is an image based on java:openjdk-8 with addition compiler
# tools added for java shim layer packaging.
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
Dockerfile: |
from $(DOCKER_NS)/fabric-javaenv:$(ARCH)-1.1.0
node:
# need node.js engine at runtime, currently available in baseimage
# but not in baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseimage:$(ARCH)-$(BASE_VERSION)
# Timeout duration for starting up a container and waiting for Register
# to come through. 1sec should be plenty for chaincode unit tests
startuptimeout: 300s
# Timeout duration for Invoke and Init calls to prevent runaway.
# This timeout is used by all chaincodes in all the channels, including
# system chaincodes.
# Note that during Invoke, if the image is not available (e.g. being
# cleaned up when in development environment), the peer will automatically
# build the image, which might take more time. In production environment,
# the chaincode image is unlikely to be deleted, so the timeout could be
# reduced accordingly.
executetimeout: 30s
# There are 2 modes: "dev" and "net".
# In dev mode, user runs the chaincode after starting peer from
# command line on local machine.
# In net mode, peer will run chaincode in a docker container.
mode: net
# keepalive in seconds. In situations where the communiction goes through a
# proxy that does not support keep-alive, this parameter will maintain connection
# between peer and chaincode.
# A value <= 0 turns keepalive off
keepalive: 0
# system chaincodes whitelist. To add system chaincode "myscc" to the
# whitelist, add "myscc: enable" to the list below, and register in
# chaincode/importsysccs.go
system:
cscc: enable
lscc: enable
escc: enable
vscc: enable
qscc: enable
# System chaincode plugins: in addition to being imported and compiled
# into fabric through core/chaincode/importsysccs.go, system chaincodes
# can also be loaded as shared objects compiled as Go plugins.
# See examples/plugins/scc for an example.
# Like regular system chaincodes, plugins must also be white listed in the
# chaincode.system section above.
systemPlugins:
# example configuration:
# - enabled: true
# name: myscc
# path: /opt/lib/myscc.so
# invokableExternal: true
# invokableCC2CC: true
# Logging section for the chaincode container
logging:
# Default level for all loggers within the chaincode container
level: info
# Override default level for the 'shim' module
shim: warning
# Format for the chaincode container logs
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
###############################################################################
#
# Ledger section - ledger configuration encompases both the blockchain
# and the state
#
###############################################################################
ledger:
blockchain:
state:
# stateDatabase - options are "goleveldb", "CouchDB"
# goleveldb - default state database stored in goleveldb.
# CouchDB - store state database in CouchDB
stateDatabase: goleveldb
couchDBConfig:
# It is recommended to run CouchDB on the same server as the peer, and
# not map the CouchDB container port to a server port in docker-compose.
# Otherwise proper security must be provided on the connection between
# CouchDB client (on the peer) and server.
couchDBAddress: 127.0.0.1:5984
# This username must have read and write authority on CouchDB
username:
# The password is recommended to pass as an environment variable
# during start up (eg LEDGER_COUCHDBCONFIG_PASSWORD).
# If it is stored here, the file must be access control protected
# to prevent unintended users from discovering the password.
password:
# Number of retries for CouchDB errors
maxRetries: 3
# Number of retries for CouchDB errors during peer startup
maxRetriesOnStartup: 10
# CouchDB request timeout (unit: duration, e.g. 20s)
requestTimeout: 35s
# Limit on the number of records to return per query
queryLimit: 10000
# Limit on the number of records per CouchDB bulk update batch
maxBatchUpdateSize: 1000
# Warm indexes after every N blocks.
# This option warms any indexes that have been
# deployed to CouchDB after every N blocks.
# A value of 1 will warm indexes after every block commit,
# to ensure fast selector queries.
# Increasing the value may improve write efficiency of peer and CouchDB,
# but may degrade query response time.
warmIndexesAfterNBlocks: 1
history:
# enableHistoryDatabase - options are true or false
# Indicates if the history of key updates should be stored.
# All history 'index' will be stored in goleveldb, regardless if using
# CouchDB or alternate database for the state.
enableHistoryDatabase: true
###############################################################################
#
# Metrics section
#
#
###############################################################################
metrics:
# enable or disable metrics server
enabled: false
# when enable metrics server, must specific metrics reporter type
# currently supported type: "statsd","prom"
reporter: statsd
# determines frequency of report metrics(unit: second)
interval: 1s
statsdReporter:
# statsd server address to connect
address: 0.0.0.0:8125
# determines frequency of push metrics to statsd server(unit: second)
flushInterval: 2s
# max size bytes for each push metrics request
# intranet recommend 1432 and internet recommend 512
flushBytes: 1432
promReporter:
# prometheus http server listen address for pull metrics
listenAddress: 0.0.0.0:8080
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# ---------------------------------------------------------------------------
# "OrdererOrgs" - Definition of organizations managing orderer nodes
# ---------------------------------------------------------------------------
OrdererOrgs:
# ---------------------------------------------------------------------------
# Orderer
# ---------------------------------------------------------------------------
- Name: Orderer
Domain: example.com
CA:
Country: US
Province: California
Locality: San Francisco
# ---------------------------------------------------------------------------
# "Specs" - See PeerOrgs below for complete description
# ---------------------------------------------------------------------------
Specs:
- Hostname: orderer
# ---------------------------------------------------------------------------
# "PeerOrgs" - Definition of organizations managing peer nodes
# ---------------------------------------------------------------------------
PeerOrgs:
# ---------------------------------------------------------------------------
# Org1
# ---------------------------------------------------------------------------
- Name: Org1
Domain: org1.example.com
EnableNodeOUs: true
CA:
Country: US
Province: California
Locality: San Francisco
# ---------------------------------------------------------------------------
# "Specs"
# ---------------------------------------------------------------------------
# Uncomment this section to enable the explicit definition of hosts in your
# configuration. Most users will want to use Template, below
#
# Specs is an array of Spec entries. Each Spec entry consists of two fields:
# - Hostname: (Required) The desired hostname, sans the domain.
# - CommonName: (Optional) Specifies the template or explicit override for
# the CN. By default, this is the template:
#
# "{{.Hostname}}.{{.Domain}}"
#
# which obtains its values from the Spec.Hostname and
# Org.Domain, respectively.
# ---------------------------------------------------------------------------
# Specs:
# - Hostname: foo # implicitly "foo.org1.example.com"
# CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above
# - Hostname: bar
# - Hostname: baz
# ---------------------------------------------------------------------------
# "Template"
# ---------------------------------------------------------------------------
# Allows for the definition of 1 or more hosts that are created sequentially
# from a template. By default, this looks like "peer%d" from 0 to Count-1.
# You may override the number of nodes (Count), the starting index (Start)
# or the template used to construct the name (Hostname).
#
# Note: Template and Specs are not mutually exclusive. You may define both
# sections and the aggregate nodes will be created for you. Take care with
# name collisions
# ---------------------------------------------------------------------------
Template:
Count: 2
# Start: 5
# Hostname: {{.Prefix}}{{.Index}} # default
# ---------------------------------------------------------------------------
# "Users"
# ---------------------------------------------------------------------------
# Count: The number of user accounts _in addition_ to Admin
# ---------------------------------------------------------------------------
Users:
Count: 1
# ---------------------------------------------------------------------------
# Org2: See "Org1" for full specification
# ---------------------------------------------------------------------------
- Name: Org2
Domain: org2.example.com
EnableNodeOUs: true
CA:
Country: US
Province: California
Locality: San Francisco
Template:
Count: 2
Users:
Count: 1
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"fmt"
"os"
"simple"
"github.com/hyperledger/fabric/core/chaincode/shim"
)
func main() {
err := shim.Start(&simple.SimpleChaincode{})
if err != nil {
fmt.Fprintf(os.Stderr, "Exiting Simple chaincode: %s", err)
os.Exit(2)
}
}
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
---
General:
LedgerType: file
ListenAddress: 127.0.0.1
ListenPort: 7050
TLS:
Enabled: false
PrivateKey: tls/server.key
Certificate: tls/server.crt
RootCAs:
- tls/ca.crt
ClientAuthRequired: false
ClientRootCAs:
Keepalive:
ServerMinInterval: 60s
ServerInterval: 7200s
ServerTimeout: 20s
LogLevel: info
LogFormat: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
GenesisMethod: file
GenesisProfile: TwoOrgsOrdererGenesis
SystemChannel: systestchannel
GenesisFile: systestchannel.block
LocalMSPDir: crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp
LocalMSPID: OrdererMSP
Profile:
Enabled: false
Address: 0.0.0.0:6060
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
FileKeyStore:
KeyStore:
Authentication:
TimeWindow: 15m
FileLedger:
Location: output/ledger/orderer
Prefix: hyperledger-fabric-ordererledger
RAMLedger:
HistorySize: 1000
Kafka:
Retry:
ShortInterval: 5s
ShortTotal: 10m
LongInterval: 5m
LongTotal: 12h
NetworkTimeouts:
DialTimeout: 10s
ReadTimeout: 10s
WriteTimeout: 10s
Metadata:
RetryBackoff: 250ms
RetryMax: 3
Producer:
RetryBackoff: 100ms
RetryMax: 3
Consumer:
RetryBackoff: 2s
Verbose: false
TLS:
Enabled: false
PrivateKey:
Certificate:
RootCAs:
Version:
Debug:
BroadcastTraceDir:
DeliverTraceDir:
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
###############################################################################
#
# LOGGING section
#
###############################################################################
logging:
# Default logging levels are specified here.
# Valid logging levels are case-insensitive strings chosen from
# CRITICAL | ERROR | WARNING | NOTICE | INFO | DEBUG
# The overall default logging level can be specified in various ways,
# listed below from strongest to weakest:
#
# 1. The --logging-level=<level> command line option overrides all other
# default specifications.
#
# 2. The environment variable CORE_LOGGING_LEVEL otherwise applies to
# all peer commands if defined as a non-empty string.
#
# 3. The value of `level` that directly follows in this file.
#
# If no overall default level is provided via any of the above methods,
# the peer will default to INFO (the value of defaultLevel in
# common/flogging/logging.go)
# Default for all modules running within the scope of a peer.
# Note: this value is only used when --logging-level or CORE_LOGGING_LEVEL
# are not set
level: info
# The overall default values mentioned above can be overridden for the
# specific components listed in the override section below.
# Override levels for various peer modules. These levels will be
# applied once the peer has completely started. They are applied at this
# time in order to be sure every logger has been registered with the
# logging package.
# Note: the modules listed below are the only acceptable modules at this
# time.
cauthdsl: warning
gossip: warning
grpc: error
ledger: info
msp: warning
policies: warning
peer:
gossip: warning
# Message format for the peer logs
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
###############################################################################
#
# Peer section
#
###############################################################################
peer:
# The Peer id is used for identifying this Peer instance.
id: peer0.org1.example.com
# The networkId allows for logical seperation of networks
networkId: dev
# The Address at local network interface this Peer will listen on.
# By default, it will listen on all network interfaces
listenAddress: 0.0.0.0:7051
# The endpoint this peer uses to listen for inbound chaincode connections.
# If this is commented-out, the listen address is selected to be
# the peer's address (see below) with port 7052
# chaincodeListenAddress: 0.0.0.0:7052
# The endpoint the chaincode for this peer uses to connect to the peer.
# If this is not specified, the chaincodeListenAddress address is selected.
# And if chaincodeListenAddress is not specified, address is selected from
# peer listenAddress.
# chaincodeAddress: 0.0.0.0:7052
# When used as peer config, this represents the endpoint to other peers
# in the same organization. For peers in other organization, see
# gossip.externalEndpoint for more info.
# When used as CLI config, this means the peer's endpoint to interact with
address: 0.0.0.0:7051
# Whether the Peer should programmatically determine its address
# This case is useful for docker containers.
addressAutoDetect: false
# Setting for runtime.GOMAXPROCS(n). If n < 1, it does not change the
# current setting
gomaxprocs: -1
# Keepalive settings for peer server and clients
keepalive:
# MinInterval is the minimum permitted time between client pings.
# If clients send pings more frequently, the peer server will
# disconnect them
minInterval: 60s
# Client keepalive settings for communicating with other peer nodes
client:
# Interval is the time between pings to peer nodes. This must
# greater than or equal to the minInterval specified by peer
# nodes
interval: 60s
# Timeout is the duration the client waits for a response from
# peer nodes before closing the connection
timeout: 20s
# DeliveryClient keepalive settings for communication with ordering
# nodes.
deliveryClient:
# Interval is the time between pings to ordering nodes. This must
# greater than or equal to the minInterval specified by ordering
# nodes.
interval: 60s
# Timeout is the duration the client waits for a response from
# ordering nodes before closing the connection
timeout: 20s
# Gossip related configuration
gossip:
# Bootstrap set to initialize gossip with.
# This is a list of other peers that this peer reaches out to at startup.
# Important: The endpoints here have to be endpoints of peers in the same
# organization, because the peer would refuse connecting to these endpoints
# unless they are in the same organization as the peer.
bootstrap: 127.0.0.1:7051
# NOTE: orgLeader and useLeaderElection parameters are mutual exclusive.
# Setting both to true would result in the termination of the peer
# since this is undefined state. If the peers are configured with
# useLeaderElection=false, make sure there is at least 1 peer in the
# organization that its orgLeader is set to true.
# Defines whenever peer will initialize dynamic algorithm for
# "leader" selection, where leader is the peer to establish
# connection with ordering service and use delivery protocol
# to pull ledger blocks from ordering service. It is recommended to
# use leader election for large networks of peers.
useLeaderElection: true
# Statically defines peer to be an organization "leader",
# where this means that current peer will maintain connection
# with ordering service and disseminate block across peers in
# its own organization
orgLeader: false
# Overrides the endpoint that the peer publishes to peers
# in its organization. For peers in foreign organizations
# see 'externalEndpoint'
endpoint:
# Maximum count of blocks stored in memory
maxBlockCountToStore: 100
# Max time between consecutive message pushes(unit: millisecond)
maxPropagationBurstLatency: 10ms
# Max number of messages stored until a push is triggered to remote peers
maxPropagationBurstSize: 10
# Number of times a message is pushed to remote peers
propagateIterations: 1
# Number of peers selected to push messages to
propagatePeerNum: 3
# Determines frequency of pull phases(unit: second)
pullInterval: 4s
# Number of peers to pull from
pullPeerNum: 3
# Determines frequency of pulling state info messages from peers(unit: second)
requestStateInfoInterval: 4s
# Determines frequency of pushing state info messages to peers(unit: second)
publishStateInfoInterval: 4s
# Maximum time a stateInfo message is kept until expired
stateInfoRetentionInterval:
# Time from startup certificates are included in Alive messages(unit: second)
publishCertPeriod: 10s
# Should we skip verifying block messages or not (currently not in use)
skipBlockVerification: false
# Dial timeout(unit: second)
dialTimeout: 3s
# Connection timeout(unit: second)
connTimeout: 2s
# Buffer size of received messages
recvBuffSize: 20
# Buffer size of sending messages
sendBuffSize: 200
# Time to wait before pull engine processes incoming digests (unit: second)
digestWaitTime: 1s
# Time to wait before pull engine removes incoming nonce (unit: second)
requestWaitTime: 1s
# Time to wait before pull engine ends pull (unit: second)
responseWaitTime: 2s
# Alive check interval(unit: second)
aliveTimeInterval: 5s
# Alive expiration timeout(unit: second)
aliveExpirationTimeout: 25s
# Reconnect interval(unit: second)
reconnectInterval: 25s
# This is an endpoint that is published to peers outside of the organization.
# If this isn't set, the peer will not be known to other organizations.
externalEndpoint:
# Leader election service configuration
election:
# Longest time peer waits for stable membership during leader election startup (unit: second)
startupGracePeriod: 15s
# Interval gossip membership samples to check its stability (unit: second)
membershipSampleInterval: 1s
# Time passes since last declaration message before peer decides to perform leader election (unit: second)
leaderAliveThreshold: 10s
# Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second)
leaderElectionDuration: 5s
pvtData:
# pullRetryThreshold determines the maximum duration of time private data corresponding for a given block
# would be attempted to be pulled from peers until the block would be committed without the private data
pullRetryThreshold: 60s
# As private data enters the transient store, it is associated with the peer's ledger's height at that time.
# transientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit,
# and the private data residing inside the transient store that is guaranteed not to be purged.
# Private data is purged from the transient store when blocks with sequences that are multiples
# of transientstoreMaxBlockRetention are committed.
transientstoreMaxBlockRetention: 1000
# pushAckTimeout is the maximum time to wait for an acknowledgement from each peer
# at private data push at endorsement time.
pushAckTimeout: 3s
# EventHub related configuration
events:
# The address that the Event service will be enabled on the peer
address: 0.0.0.0:7053
# total number of events that could be buffered without blocking send
buffersize: 100
# timeout duration for producer to send an event.
# if < 0, if buffer full, unblocks immediately and not send
# if 0, if buffer full, will block and guarantee the event will be sent out
# if > 0, if buffer full, blocks till timeout
timeout: 10ms
# timewindow is the acceptable difference between the peer's current
# time and the client's time as specified in a registration event
timewindow: 15m
# Keepalive settings for peer server and clients
keepalive:
# MinInterval is the minimum permitted time in seconds which clients
# can send keepalive pings. If clients send pings more frequently,
# the events server will disconnect them
minInterval: 60s
# TLS Settings
# Note that peer-chaincode connections through chaincodeListenAddress is
# not mutual TLS auth. See comments on chaincodeListenAddress for more info
tls:
# Require server-side TLS
enabled: false
# Require client certificates / mutual TLS.
# Note that clients that are not configured to use a certificate will
# fail to connect to the peer.
clientAuthRequired: false
# X.509 certificate used for TLS server
cert:
file: tls/server.crt
# Private key used for TLS server (and client if clientAuthEnabled
# is set to true
key:
file: tls/server.key
# Trusted root certificate chain for tls.cert
rootcert:
file: tls/ca.crt
# Set of root certificate authorities used to verify client certificates
clientRootCAs:
files:
- tls/ca.crt
# Private key used for TLS when making client connections. If
# not set, peer.tls.key.file will be used instead
clientKey:
file:
# X.509 certificate used for TLS when making client connections.
# If not set, peer.tls.cert.file will be used instead
clientCert:
file:
# Authentication contains configuration parameters related to authenticating
# client messages
authentication:
# the acceptable difference between the current server time and the
# client's time as specified in a client request message
timewindow: 15m
# Path on the file system where peer will store data (eg ledger). This
# location must be access control protected to prevent unintended
# modification that might corrupt the peer operations.
fileSystemPath: peer1/filesystem
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of Key Store
FileKeyStore:
# If "", defaults to 'mspConfigPath'/keystore
# TODO: Ensure this is read with fabric/core/config.GetPath() once ready
KeyStore:
# Path on the file system where peer will find MSP local configurations
# mspConfigPath: crypto/peerOrganizations/org1.example.com/msp
mspConfigPath: crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp
# Identifier of the local MSP
# ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!----
# Deployers need to change the value of the localMspId string.
# In particular, the name of the local MSP ID of a peer needs
# to match the name of one of the MSPs in each of the channel
# that this peer is a member of. Otherwise this peer's messages
# will not be identified as valid by other nodes.
localMspId: Org1MSP
# Delivery service related config
deliveryclient:
# It sets the total time the delivery service may spend in reconnection
# attempts until its retry logic gives up and returns an error
reconnectTotalTimeThreshold: 3600s
# Type for the local MSP - by default it's of type bccsp
localMspType: bccsp
# Used with Go profiling tools only in none production environment. In
# production, it should be disabled (eg enabled: false)
profile:
enabled: false
listenAddress: 0.0.0.0:6060
# The admin service is used for administrative operations such as
# control over log module severity, etc.
# Only peer administrators can use the service.
adminService:
# The interface and port on which the admin server will listen on.
# If this is commented out, or the port number is equal to the port
# of the peer listen address - the admin service is attached to the
# peer's service (defaults to 7051).
#listenAddress: 0.0.0.0:7055
# Handlers defines custom handlers that can filter and mutate
# objects passing within the peer, such as:
# Auth filter - reject or forward proposals from clients
# Decorators - append or mutate the chaincode input passed to the chaincode
# Valid handler definition contains:
# - A name which is a factory method name defined in
# core/handlers/library/library.go for statically compiled handlers
# - library path to shared object binary for pluggable filters
# Auth filters and decorators are chained and executed in the order that
# they are defined. For example:
# authFilters:
# -
# name: FilterOne
# library: /opt/lib/filter.so
# -
# name: FilterTwo
# decorators:
# -
# name: DecoratorOne
# -
# name: DecoratorTwo
# library: /opt/lib/decorator.so
handlers:
authFilters:
-
name: DefaultAuth
-
name: ExpirationCheck # This filter checks identity x509 certificate expiration
decorators:
-
name: DefaultDecorator
# Number of goroutines that will execute transaction validation in parallel.
# By default, the peer chooses the number of CPUs on the machine. Set this
# variable to override that choice.
# NOTE: overriding this value might negatively influence the performance of
# the peer so please change this value only if you know what you're doing
validatorPoolSize:
###############################################################################
#
# VM section
#
###############################################################################
vm:
# Endpoint of the vm management system. For docker can be one of the following in general
# unix:///var/run/docker.sock
# http://localhost:2375
# https://localhost:2376
endpoint: unix:///var/run/docker.sock
# settings for docker vms
docker:
tls:
enabled: false
ca:
file: docker/ca.crt
cert:
file: docker/tls.crt
key:
file: docker/tls.key
# Enables/disables the standard out/err from chaincode containers for
# debugging purposes
attachStdout: false
# Parameters on creating docker container.
# Container may be efficiently created using ipam & dns-server for cluster
# NetworkMode - sets the networking mode for the container. Supported
# standard values are: `host`(default),`bridge`,`ipvlan`,`none`.
# Dns - a list of DNS servers for the container to use.
# Note: `Privileged` `Binds` `Links` and `PortBindings` properties of
# Docker Host Config are not supported and will not be used if set.
# LogConfig - sets the logging driver (Type) and related options
# (Config) for Docker. For more info,
# https://docs.docker.com/engine/admin/logging/overview/
# Note: Set LogConfig using Environment Variables is not supported.
hostConfig:
NetworkMode: host
Dns:
# - 192.168.0.1
LogConfig:
Type: json-file
Config:
max-size: "50m"
max-file: "5"
Memory: 2147483648
###############################################################################
#
# Chaincode section
#
###############################################################################
chaincode:
# The id is used by the Chaincode stub to register the executing Chaincode
# ID with the Peer and is generally supplied through ENV variables
# the `path` form of ID is provided when installing the chaincode.
# The `name` is used for all other requests and can be any string.
id:
path:
name:
# Generic builder environment, suitable for most chaincode types
builder: $(DOCKER_NS)/fabric-ccenv:$(ARCH)-$(PROJECT_VERSION)
# Enables/disables force pulling of the base docker images (listed below)
# during user chaincode instantiation.
# Useful when using moving image tags (such as :latest)
pull: false
golang:
# golang will never need more than baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
# whether or not golang chaincode should be linked dynamically
dynamicLink: false
car:
# car may need more facilities (JVM, etc) in the future as the catalog
# of platforms are expanded. For now, we can just use baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
java:
# This is an image based on java:openjdk-8 with addition compiler
# tools added for java shim layer packaging.
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
Dockerfile: |
from $(DOCKER_NS)/fabric-javaenv:$(ARCH)-1.1.0
node:
# need node.js engine at runtime, currently available in baseimage
# but not in baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseimage:$(ARCH)-$(BASE_VERSION)
# Timeout duration for starting up a container and waiting for Register
# to come through. 1sec should be plenty for chaincode unit tests
startuptimeout: 300s
# Timeout duration for Invoke and Init calls to prevent runaway.
# This timeout is used by all chaincodes in all the channels, including
# system chaincodes.
# Note that during Invoke, if the image is not available (e.g. being
# cleaned up when in development environment), the peer will automatically
# build the image, which might take more time. In production environment,
# the chaincode image is unlikely to be deleted, so the timeout could be
# reduced accordingly.
executetimeout: 30s
# There are 2 modes: "dev" and "net".
# In dev mode, user runs the chaincode after starting peer from
# command line on local machine.
# In net mode, peer will run chaincode in a docker container.
mode: net
# keepalive in seconds. In situations where the communiction goes through a
# proxy that does not support keep-alive, this parameter will maintain connection
# between peer and chaincode.
# A value <= 0 turns keepalive off
keepalive: 0
# system chaincodes whitelist. To add system chaincode "myscc" to the
# whitelist, add "myscc: enable" to the list below, and register in
# chaincode/importsysccs.go
system:
cscc: enable
lscc: enable
escc: enable
vscc: enable
qscc: enable
# System chaincode plugins: in addition to being imported and compiled
# into fabric through core/chaincode/importsysccs.go, system chaincodes
# can also be loaded as shared objects compiled as Go plugins.
# See examples/plugins/scc for an example.
# Like regular system chaincodes, plugins must also be white listed in the
# chaincode.system section above.
systemPlugins:
# example configuration:
# - enabled: true
# name: myscc
# path: /opt/lib/myscc.so
# invokableExternal: true
# invokableCC2CC: true
# Logging section for the chaincode container
logging:
# Default level for all loggers within the chaincode container
level: info
# Override default level for the 'shim' module
shim: warning
# Format for the chaincode container logs
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
###############################################################################
#
# Ledger section - ledger configuration encompases both the blockchain
# and the state
#
###############################################################################
ledger:
blockchain:
state:
# stateDatabase - options are "goleveldb", "CouchDB"
# goleveldb - default state database stored in goleveldb.
# CouchDB - store state database in CouchDB
stateDatabase: goleveldb
couchDBConfig:
# It is recommended to run CouchDB on the same server as the peer, and
# not map the CouchDB container port to a server port in docker-compose.
# Otherwise proper security must be provided on the connection between
# CouchDB client (on the peer) and server.
couchDBAddress: 127.0.0.1:5984
# This username must have read and write authority on CouchDB
username:
# The password is recommended to pass as an environment variable
# during start up (eg LEDGER_COUCHDBCONFIG_PASSWORD).
# If it is stored here, the file must be access control protected
# to prevent unintended users from discovering the password.
password:
# Number of retries for CouchDB errors
maxRetries: 3
# Number of retries for CouchDB errors during peer startup
maxRetriesOnStartup: 10
# CouchDB request timeout (unit: duration, e.g. 20s)
requestTimeout: 35s
# Limit on the number of records to return per query
queryLimit: 10000
# Limit on the number of records per CouchDB bulk update batch
maxBatchUpdateSize: 1000
# Warm indexes after every N blocks.
# This option warms any indexes that have been
# deployed to CouchDB after every N blocks.
# A value of 1 will warm indexes after every block commit,
# to ensure fast selector queries.
# Increasing the value may improve write efficiency of peer and CouchDB,
# but may degrade query response time.
warmIndexesAfterNBlocks: 1
history:
# enableHistoryDatabase - options are true or false
# Indicates if the history of key updates should be stored.
# All history 'index' will be stored in goleveldb, regardless if using
# CouchDB or alternate database for the state.
enableHistoryDatabase: true
###############################################################################
#
# Metrics section
#
#
###############################################################################
metrics:
# enable or disable metrics server
enabled: false
# when enable metrics server, must specific metrics reporter type
# currently supported type: "statsd","prom"
reporter: statsd
# determines frequency of report metrics(unit: second)
interval: 1s
statsdReporter:
# statsd server address to connect
address: 0.0.0.0:8125
# determines frequency of push metrics to statsd server(unit: second)
flushInterval: 2s
# max size bytes for each push metrics request
# intranet recommend 1432 and internet recommend 512
flushBytes: 1432
promReporter:
# prometheus http server listen address for pull metrics
listenAddress: 0.0.0.0:8080
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
###############################################################################
#
# LOGGING section
#
###############################################################################
logging:
# Default logging levels are specified here.
# Valid logging levels are case-insensitive strings chosen from
# CRITICAL | ERROR | WARNING | NOTICE | INFO | DEBUG
# The overall default logging level can be specified in various ways,
# listed below from strongest to weakest:
#
# 1. The --logging-level=<level> command line option overrides all other
# default specifications.
#
# 2. The environment variable CORE_LOGGING_LEVEL otherwise applies to
# all peer commands if defined as a non-empty string.
#
# 3. The value of `level` that directly follows in this file.
#
# If no overall default level is provided via any of the above methods,
# the peer will default to INFO (the value of defaultLevel in
# common/flogging/logging.go)
# Default for all modules running within the scope of a peer.
# Note: this value is only used when --logging-level or CORE_LOGGING_LEVEL
# are not set
level: info
# The overall default values mentioned above can be overridden for the
# specific components listed in the override section below.
# Override levels for various peer modules. These levels will be
# applied once the peer has completely started. They are applied at this
# time in order to be sure every logger has been registered with the
# logging package.
# Note: the modules listed below are the only acceptable modules at this
# time.
cauthdsl: warning
gossip: warning
grpc: error
ledger: info
msp: warning
policies: warning
peer:
gossip: warning
# Message format for the peer logs
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
###############################################################################
#
# Peer section
#
###############################################################################
peer:
# The Peer id is used for identifying this Peer instance.
id: peer0.org2.example.com
# The networkId allows for logical seperation of networks
networkId: dev
# The Address at local network interface this Peer will listen on.
# By default, it will listen on all network interfaces
listenAddress: 0.0.0.0:8051
# The endpoint this peer uses to listen for inbound chaincode connections.
# If this is commented-out, the listen address is selected to be
# the peer's address (see below) with port 7052
chaincodeListenAddress: 0.0.0.0:8052
# The endpoint the chaincode for this peer uses to connect to the peer.
# If this is not specified, the chaincodeListenAddress address is selected.
# And if chaincodeListenAddress is not specified, address is selected from
# peer listenAddress.
# chaincodeAddress: 0.0.0.0:7052
# When used as peer config, this represents the endpoint to other peers
# in the same organization. For peers in other organization, see
# gossip.externalEndpoint for more info.
# When used as CLI config, this means the peer's endpoint to interact with
address: 0.0.0.0:8051
# Whether the Peer should programmatically determine its address
# This case is useful for docker containers.
addressAutoDetect: false
# Setting for runtime.GOMAXPROCS(n). If n < 1, it does not change the
# current setting
gomaxprocs: -1
# Keepalive settings for peer server and clients
keepalive:
# MinInterval is the minimum permitted time between client pings.
# If clients send pings more frequently, the peer server will
# disconnect them
minInterval: 60s
# Client keepalive settings for communicating with other peer nodes
client:
# Interval is the time between pings to peer nodes. This must
# greater than or equal to the minInterval specified by peer
# nodes
interval: 60s
# Timeout is the duration the client waits for a response from
# peer nodes before closing the connection
timeout: 20s
# DeliveryClient keepalive settings for communication with ordering
# nodes.
deliveryClient:
# Interval is the time between pings to ordering nodes. This must
# greater than or equal to the minInterval specified by ordering
# nodes.
interval: 60s
# Timeout is the duration the client waits for a response from
# ordering nodes before closing the connection
timeout: 20s
# Gossip related configuration
gossip:
# Bootstrap set to initialize gossip with.
# This is a list of other peers that this peer reaches out to at startup.
# Important: The endpoints here have to be endpoints of peers in the same
# organization, because the peer would refuse connecting to these endpoints
# unless they are in the same organization as the peer.
bootstrap: 127.0.0.1:8051
# NOTE: orgLeader and useLeaderElection parameters are mutual exclusive.
# Setting both to true would result in the termination of the peer
# since this is undefined state. If the peers are configured with
# useLeaderElection=false, make sure there is at least 1 peer in the
# organization that its orgLeader is set to true.
# Defines whenever peer will initialize dynamic algorithm for
# "leader" selection, where leader is the peer to establish
# connection with ordering service and use delivery protocol
# to pull ledger blocks from ordering service. It is recommended to
# use leader election for large networks of peers.
useLeaderElection: true
# Statically defines peer to be an organization "leader",
# where this means that current peer will maintain connection
# with ordering service and disseminate block across peers in
# its own organization
orgLeader: false
# Overrides the endpoint that the peer publishes to peers
# in its organization. For peers in foreign organizations
# see 'externalEndpoint'
endpoint:
# Maximum count of blocks stored in memory
maxBlockCountToStore: 100
# Max time between consecutive message pushes(unit: millisecond)
maxPropagationBurstLatency: 10ms
# Max number of messages stored until a push is triggered to remote peers
maxPropagationBurstSize: 10
# Number of times a message is pushed to remote peers
propagateIterations: 1
# Number of peers selected to push messages to
propagatePeerNum: 3
# Determines frequency of pull phases(unit: second)
pullInterval: 4s
# Number of peers to pull from
pullPeerNum: 3
# Determines frequency of pulling state info messages from peers(unit: second)
requestStateInfoInterval: 4s
# Determines frequency of pushing state info messages to peers(unit: second)
publishStateInfoInterval: 4s
# Maximum time a stateInfo message is kept until expired
stateInfoRetentionInterval:
# Time from startup certificates are included in Alive messages(unit: second)
publishCertPeriod: 10s
# Should we skip verifying block messages or not (currently not in use)
skipBlockVerification: false
# Dial timeout(unit: second)
dialTimeout: 3s
# Connection timeout(unit: second)
connTimeout: 2s
# Buffer size of received messages
recvBuffSize: 20
# Buffer size of sending messages
sendBuffSize: 200
# Time to wait before pull engine processes incoming digests (unit: second)
digestWaitTime: 1s
# Time to wait before pull engine removes incoming nonce (unit: second)
requestWaitTime: 1s
# Time to wait before pull engine ends pull (unit: second)
responseWaitTime: 2s
# Alive check interval(unit: second)
aliveTimeInterval: 5s
# Alive expiration timeout(unit: second)
aliveExpirationTimeout: 25s
# Reconnect interval(unit: second)
reconnectInterval: 25s
# This is an endpoint that is published to peers outside of the organization.
# If this isn't set, the peer will not be known to other organizations.
externalEndpoint:
# Leader election service configuration
election:
# Longest time peer waits for stable membership during leader election startup (unit: second)
startupGracePeriod: 15s
# Interval gossip membership samples to check its stability (unit: second)
membershipSampleInterval: 1s
# Time passes since last declaration message before peer decides to perform leader election (unit: second)
leaderAliveThreshold: 10s
# Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second)
leaderElectionDuration: 5s
pvtData:
# pullRetryThreshold determines the maximum duration of time private data corresponding for a given block
# would be attempted to be pulled from peers until the block would be committed without the private data
pullRetryThreshold: 60s
# As private data enters the transient store, it is associated with the peer's ledger's height at that time.
# transientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit,
# and the private data residing inside the transient store that is guaranteed not to be purged.
# Private data is purged from the transient store when blocks with sequences that are multiples
# of transientstoreMaxBlockRetention are committed.
transientstoreMaxBlockRetention: 1000
# pushAckTimeout is the maximum time to wait for an acknowledgement from each peer
# at private data push at endorsement time.
pushAckTimeout: 3s
# EventHub related configuration
events:
# The address that the Event service will be enabled on the peer
address: 0.0.0.0:8053
# total number of events that could be buffered without blocking send
buffersize: 100
# timeout duration for producer to send an event.
# if < 0, if buffer full, unblocks immediately and not send
# if 0, if buffer full, will block and guarantee the event will be sent out
# if > 0, if buffer full, blocks till timeout
timeout: 10ms
# timewindow is the acceptable difference between the peer's current
# time and the client's time as specified in a registration event
timewindow: 15m
# Keepalive settings for peer server and clients
keepalive:
# MinInterval is the minimum permitted time in seconds which clients
# can send keepalive pings. If clients send pings more frequently,
# the events server will disconnect them
minInterval: 60s
# TLS Settings
# Note that peer-chaincode connections through chaincodeListenAddress is
# not mutual TLS auth. See comments on chaincodeListenAddress for more info
tls:
# Require server-side TLS
enabled: false
# Require client certificates / mutual TLS.
# Note that clients that are not configured to use a certificate will
# fail to connect to the peer.
clientAuthRequired: false
# X.509 certificate used for TLS server
cert:
file: tls/server.crt
# Private key used for TLS server (and client if clientAuthEnabled
# is set to true
key:
file: tls/server.key
# Trusted root certificate chain for tls.cert
rootcert:
file: tls/ca.crt
# Set of root certificate authorities used to verify client certificates
clientRootCAs:
files:
- tls/ca.crt
# Private key used for TLS when making client connections. If
# not set, peer.tls.key.file will be used instead
clientKey:
file:
# X.509 certificate used for TLS when making client connections.
# If not set, peer.tls.cert.file will be used instead
clientCert:
file:
# Authentication contains configuration parameters related to authenticating
# client messages
authentication:
# the acceptable difference between the current server time and the
# client's time as specified in a client request message
timewindow: 15m
# Path on the file system where peer will store data (eg ledger). This
# location must be access control protected to prevent unintended
# modification that might corrupt the peer operations.
fileSystemPath: peer1/filesystem
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of Key Store
FileKeyStore:
# If "", defaults to 'mspConfigPath'/keystore
# TODO: Ensure this is read with fabric/core/config.GetPath() once ready
KeyStore:
# Path on the file system where peer will find MSP local configurations
mspConfigPath: crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp
# Identifier of the local MSP
# ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!----
# Deployers need to change the value of the localMspId string.
# In particular, the name of the local MSP ID of a peer needs
# to match the name of one of the MSPs in each of the channel
# that this peer is a member of. Otherwise this peer's messages
# will not be identified as valid by other nodes.
localMspId: Org2MSP
# Delivery service related config
deliveryclient:
# It sets the total time the delivery service may spend in reconnection
# attempts until its retry logic gives up and returns an error
reconnectTotalTimeThreshold: 3600s
# Type for the local MSP - by default it's of type bccsp
localMspType: bccsp
# Used with Go profiling tools only in none production environment. In
# production, it should be disabled (eg enabled: false)
profile:
enabled: false
listenAddress: 0.0.0.0:6060
# The admin service is used for administrative operations such as
# control over log module severity, etc.
# Only peer administrators can use the service.
adminService:
# The interface and port on which the admin server will listen on.
# If this is commented out, or the port number is equal to the port
# of the peer listen address - the admin service is attached to the
# peer's service (defaults to 7051).
#listenAddress: 0.0.0.0:7055
# Handlers defines custom handlers that can filter and mutate
# objects passing within the peer, such as:
# Auth filter - reject or forward proposals from clients
# Decorators - append or mutate the chaincode input passed to the chaincode
# Valid handler definition contains:
# - A name which is a factory method name defined in
# core/handlers/library/library.go for statically compiled handlers
# - library path to shared object binary for pluggable filters
# Auth filters and decorators are chained and executed in the order that
# they are defined. For example:
# authFilters:
# -
# name: FilterOne
# library: /opt/lib/filter.so
# -
# name: FilterTwo
# decorators:
# -
# name: DecoratorOne
# -
# name: DecoratorTwo
# library: /opt/lib/decorator.so
handlers:
authFilters:
-
name: DefaultAuth
-
name: ExpirationCheck # This filter checks identity x509 certificate expiration
decorators:
-
name: DefaultDecorator
# Number of goroutines that will execute transaction validation in parallel.
# By default, the peer chooses the number of CPUs on the machine. Set this
# variable to override that choice.
# NOTE: overriding this value might negatively influence the performance of
# the peer so please change this value only if you know what you're doing
validatorPoolSize:
###############################################################################
#
# VM section
#
###############################################################################
vm:
# Endpoint of the vm management system. For docker can be one of the following in general
# unix:///var/run/docker.sock
# http://localhost:2375
# https://localhost:2376
endpoint: unix:///var/run/docker.sock
# settings for docker vms
docker:
tls:
enabled: false
ca:
file: docker/ca.crt
cert:
file: docker/tls.crt
key:
file: docker/tls.key
# Enables/disables the standard out/err from chaincode containers for
# debugging purposes
attachStdout: false
# Parameters on creating docker container.
# Container may be efficiently created using ipam & dns-server for cluster
# NetworkMode - sets the networking mode for the container. Supported
# standard values are: `host`(default),`bridge`,`ipvlan`,`none`.
# Dns - a list of DNS servers for the container to use.
# Note: `Privileged` `Binds` `Links` and `PortBindings` properties of
# Docker Host Config are not supported and will not be used if set.
# LogConfig - sets the logging driver (Type) and related options
# (Config) for Docker. For more info,
# https://docs.docker.com/engine/admin/logging/overview/
# Note: Set LogConfig using Environment Variables is not supported.
hostConfig:
NetworkMode: host
Dns:
# - 192.168.0.1
LogConfig:
Type: json-file
Config:
max-size: "50m"
max-file: "5"
Memory: 2147483648
###############################################################################
#
# Chaincode section
#
###############################################################################
chaincode:
# The id is used by the Chaincode stub to register the executing Chaincode
# ID with the Peer and is generally supplied through ENV variables
# the `path` form of ID is provided when installing the chaincode.
# The `name` is used for all other requests and can be any string.
id:
path:
name:
# Generic builder environment, suitable for most chaincode types
builder: $(DOCKER_NS)/fabric-ccenv:$(ARCH)-$(PROJECT_VERSION)
# Enables/disables force pulling of the base docker images (listed below)
# during user chaincode instantiation.
# Useful when using moving image tags (such as :latest)
pull: false
golang:
# golang will never need more than baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
# whether or not golang chaincode should be linked dynamically
dynamicLink: false
car:
# car may need more facilities (JVM, etc) in the future as the catalog
# of platforms are expanded. For now, we can just use baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
java:
# This is an image based on java:openjdk-8 with addition compiler
# tools added for java shim layer packaging.
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
Dockerfile: |
from $(DOCKER_NS)/fabric-javaenv:$(ARCH)-1.1.0
node:
# need node.js engine at runtime, currently available in baseimage
# but not in baseos
runtime: $(BASE_DOCKER_NS)/fabric-baseimage:$(ARCH)-$(BASE_VERSION)
# Timeout duration for starting up a container and waiting for Register
# to come through. 1sec should be plenty for chaincode unit tests
startuptimeout: 300s
# Timeout duration for Invoke and Init calls to prevent runaway.
# This timeout is used by all chaincodes in all the channels, including
# system chaincodes.
# Note that during Invoke, if the image is not available (e.g. being
# cleaned up when in development environment), the peer will automatically
# build the image, which might take more time. In production environment,
# the chaincode image is unlikely to be deleted, so the timeout could be
# reduced accordingly.
executetimeout: 30s
# There are 2 modes: "dev" and "net".
# In dev mode, user runs the chaincode after starting peer from
# command line on local machine.
# In net mode, peer will run chaincode in a docker container.
mode: net
# keepalive in seconds. In situations where the communiction goes through a
# proxy that does not support keep-alive, this parameter will maintain connection
# between peer and chaincode.
# A value <= 0 turns keepalive off
keepalive: 0
# system chaincodes whitelist. To add system chaincode "myscc" to the
# whitelist, add "myscc: enable" to the list below, and register in
# chaincode/importsysccs.go
system:
cscc: enable
lscc: enable
escc: enable
vscc: enable
qscc: enable
# System chaincode plugins: in addition to being imported and compiled
# into fabric through core/chaincode/importsysccs.go, system chaincodes
# can also be loaded as shared objects compiled as Go plugins.
# See examples/plugins/scc for an example.
# Like regular system chaincodes, plugins must also be white listed in the
# chaincode.system section above.
systemPlugins:
# example configuration:
# - enabled: true
# name: myscc
# path: /opt/lib/myscc.so
# invokableExternal: true
# invokableCC2CC: true
# Logging section for the chaincode container
logging:
# Default level for all loggers within the chaincode container
level: info
# Override default level for the 'shim' module
shim: warning
# Format for the chaincode container logs
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
###############################################################################
#
# Ledger section - ledger configuration encompases both the blockchain
# and the state
#
###############################################################################
ledger:
blockchain:
state:
# stateDatabase - options are "goleveldb", "CouchDB"
# goleveldb - default state database stored in goleveldb.
# CouchDB - store state database in CouchDB
stateDatabase: goleveldb
couchDBConfig:
# It is recommended to run CouchDB on the same server as the peer, and
# not map the CouchDB container port to a server port in docker-compose.
# Otherwise proper security must be provided on the connection between
# CouchDB client (on the peer) and server.
couchDBAddress: 127.0.0.1:5984
# This username must have read and write authority on CouchDB
username:
# The password is recommended to pass as an environment variable
# during start up (eg LEDGER_COUCHDBCONFIG_PASSWORD).
# If it is stored here, the file must be access control protected
# to prevent unintended users from discovering the password.
password:
# Number of retries for CouchDB errors
maxRetries: 3
# Number of retries for CouchDB errors during peer startup
maxRetriesOnStartup: 10
# CouchDB request timeout (unit: duration, e.g. 20s)
requestTimeout: 35s
# Limit on the number of records to return per query
queryLimit: 10000
# Limit on the number of records per CouchDB bulk update batch
maxBatchUpdateSize: 1000
# Warm indexes after every N blocks.
# This option warms any indexes that have been
# deployed to CouchDB after every N blocks.
# A value of 1 will warm indexes after every block commit,
# to ensure fast selector queries.
# Increasing the value may improve write efficiency of peer and CouchDB,
# but may degrade query response time.
warmIndexesAfterNBlocks: 1
history:
# enableHistoryDatabase - options are true or false
# Indicates if the history of key updates should be stored.
# All history 'index' will be stored in goleveldb, regardless if using
# CouchDB or alternate database for the state.
enableHistoryDatabase: true
###############################################################################
#
# Metrics section
#
#
###############################################################################
metrics:
# enable or disable metrics server
enabled: false
# when enable metrics server, must specific metrics reporter type
# currently supported type: "statsd","prom"
reporter: statsd
# determines frequency of report metrics(unit: second)
interval: 1s
statsdReporter:
# statsd server address to connect
address: 0.0.0.0:8125
# determines frequency of push metrics to statsd server(unit: second)
flushInterval: 2s
# max size bytes for each push metrics request
# intranet recommend 1432 and internet recommend 512
flushBytes: 1432
promReporter:
# prometheus http server listen address for pull metrics
listenAddress: 0.0.0.0:8080
#!/bin/bash -ex
pwd
# /Users/cfdojo/workspace/fabric/standalone
killall orderer peer
rm -rf output peer1 peer2
mkdir -p output/crypto
cryptogen generate --config testdata/crypto-config.yaml --output output/crypto
# org1.example.com
# org2.example.com
cp testdata/configtx.yaml output
FABRIC_CFG_PATH=$PWD/output configtxgen -profile TwoOrgsOrdererGenesis -channelID systestchannel -outputBlock $PWD/output/systestchannel.block # systest should be system
# 2018-04-04 13:54:45.571 EDT [common/tools/configtxgen] main -> INFO 001 Loading configuration
# 2018-04-04 13:54:45.578 EDT [common/tools/configtxgen] doOutputBlock -> INFO 002 Generating genesis block
# 2018-04-04 13:54:45.579 EDT [common/tools/configtxgen] doOutputBlock -> INFO 003 Writing genesis block
# NOTE: This assumes a lot of stuff. Bugs are needed. See whiteboard.
# - No flag for config path (should really be config dir not path...)
# - Assumes configtx.yaml is in the config path and provides no way to point to the file
# - Uses contents of configtx.yaml to determine relative path of crypto material (MSPDir)
FABRIC_CFG_PATH=$PWD/output configtxgen -profile TwoOrgsChannel -channelID testchannel -outputCreateChannelTx $PWD/output/testchannel.tx
# 2018-04-04 14:00:26.214 EDT [common/tools/configtxgen] main -> INFO 001 Loading configuration
# 2018-04-04 14:00:26.220 EDT [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
# 2018-04-04 14:00:26.238 EDT [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 003 Writing new channel tx
FABRIC_CFG_PATH=$PWD/output configtxgen -profile TwoOrgsChannel -channelID testchannel -asOrg Org1 -outputAnchorPeersUpdate $PWD/output/Org1MSPAnchors.tx
# 2018-04-04 14:02:45.153 EDT [common/tools/configtxgen] main -> INFO 001 Loading configuration
# 2018-04-04 14:02:45.159 EDT [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
# 2018-04-04 14:02:45.159 EDT [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
FABRIC_CFG_PATH=$PWD/output configtxgen -profile TwoOrgsChannel -channelID testchannel -asOrg Org2 -outputAnchorPeersUpdate $PWD/output/Org2MSPAnchors.tx
# 2018-04-04 14:05:09.075 EDT [common/tools/configtxgen] main -> INFO 001 Loading configuration
# 2018-04-04 14:05:09.081 EDT [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
# 2018-04-04 14:05:09.081 EDT [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
cp testdata/core.yaml testdata/orderer.yaml output/
FABRIC_CFG_PATH=$PWD/output orderer start 2>&1 &
# 2018-04-04 14:22:44.013 EDT [orderer/common/server] prettyPrintStruct -> INFO 001 Orderer config values:
# General.LedgerType = "file"
# General.ListenAddress = "127.0.0.1"
# General.ListenPort = 7050
# General.TLS.Enabled = false
# General.TLS.PrivateKey = "/Users/cfdojo/workspace/fabric/standalone/output/tls/server.key"
# General.TLS.Certificate = "/Users/cfdojo/workspace/fabric/standalone/output/tls/server.crt"
# General.TLS.RootCAs = [/Users/cfdojo/workspace/fabric/standalone/output/tls/ca.crt]
# General.TLS.ClientAuthRequired = false
# General.TLS.ClientRootCAs = []
# General.Keepalive.ServerMinInterval = 1m0s
# General.Keepalive.ServerInterval = 2h0m0s
# General.Keepalive.ServerTimeout = 20s
# General.GenesisMethod = "file"
# General.GenesisProfile = "TwoOrgsOrdererGenesis"
# General.SystemChannel = "testchainid"
# General.GenesisFile = "/Users/cfdojo/workspace/fabric/standalone/output/systestchannel.block"
# General.Profile.Enabled = false
# General.Profile.Address = "0.0.0.0:6060"
# General.LogLevel = "info"
# General.LogFormat = "%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}"
# General.LocalMSPDir = "/Users/cfdojo/workspace/fabric/standalone/output/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp"
# General.LocalMSPID = "OrdererMSP"
# General.BCCSP.ProviderName = "SW"
# General.BCCSP.SwOpts.SecLevel = 256
# General.BCCSP.SwOpts.HashFamily = "SHA2"
# General.BCCSP.SwOpts.Ephemeral = false
# General.BCCSP.SwOpts.FileKeystore.KeyStorePath = "/Users/cfdojo/workspace/fabric/standalone/output/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/keystore"
# General.BCCSP.SwOpts.DummyKeystore =
# General.BCCSP.PluginOpts =
# General.BCCSP.Pkcs11Opts =
# General.Authentication.TimeWindow = 15m0s
# FileLedger.Location = "output/ledger/orderer"
# FileLedger.Prefix = "hyperledger-fabric-ordererledger"
# RAMLedger.HistorySize = 1000
# Kafka.Retry.ShortInterval = 5s
# Kafka.Retry.ShortTotal = 10m0s
# Kafka.Retry.LongInterval = 5m0s
# Kafka.Retry.LongTotal = 12h0m0s
# Kafka.Retry.NetworkTimeouts.DialTimeout = 10s
# Kafka.Retry.NetworkTimeouts.ReadTimeout = 10s
# Kafka.Retry.NetworkTimeouts.WriteTimeout = 10s
# Kafka.Retry.Metadata.RetryMax = 3
# Kafka.Retry.Metadata.RetryBackoff = 250ms
# Kafka.Retry.Producer.RetryMax = 3
# Kafka.Retry.Producer.RetryBackoff = 100ms
# Kafka.Retry.Consumer.RetryBackoff = 2s
# Kafka.Verbose = false
# Kafka.Version = 0.10.2.0
# Kafka.TLS.Enabled = false
# Kafka.TLS.PrivateKey = ""
# Kafka.TLS.Certificate = ""
# Kafka.TLS.RootCAs = []
# Kafka.TLS.ClientAuthRequired = false
# Kafka.TLS.ClientRootCAs = []
# Debug.BroadcastTraceDir = ""
# Debug.DeliverTraceDir = ""
# 2018-04-04 14:22:44.018 EDT [orderer/common/server] initializeMultichannelRegistrar -> INFO 002 Not bootstrapping because of existing chains
# 2018-04-04 14:22:44.023 EDT [orderer/commmon/multichannel] NewRegistrar -> INFO 003 Starting system channel 'systestchannel' with genesis block hash a5a125684385dbe94986cfb082956e3685f5c516745255bdc0f4dde845a03e49 and orderer type solo
# 2018-04-04 14:22:44.023 EDT [orderer/common/server] Start -> INFO 004 Starting orderer:
# Version: 1.2.0-snapshot-3fd90a9c
# Go version: go1.10.1
# OS/Arch: darwin/amd64
# Experimental features: true
# 2018-04-04 14:22:44.023 EDT [orderer/common/server] Start -> INFO 005 Beginning to serve requests
mkdir peer1 # TODO output/orderer output/peer etc
cp testdata/peer1-core.yaml peer1/core.yaml
cp -pr output/crypto peer1
FABRIC_CFG_PATH=$PWD/peer1 peer node start 2>&1 &
# 2018-04-04 14:40:09.294 EDT [msp] getMspConfig -> INFO 001 Loading NodeOUs
# 2018-04-04 14:40:09.310 EDT [nodeCmd] serve -> INFO 002 Starting peer:
# Version: 1.2.0-snapshot-3fd90a9c
# Go version: go1.10.1
# OS/Arch: darwin/amd64
# Experimental features: true
# Chaincode:
# Base Image Version: 0.4.6
# Base Docker Namespace: hyperledger
# Base Docker Label: org.hyperledger.fabric
# Docker Namespace: hyperledger
# 2018-04-04 14:40:09.310 EDT [ledgermgmt] initialize -> INFO 003 Initializing ledger mgmt
# 2018-04-04 14:40:09.311 EDT [kvledger] NewProvider -> INFO 004 Initializing ledger provider
# 2018-04-04 14:40:09.319 EDT [kvledger] NewProvider -> INFO 005 ledger provider Initialized
# 2018-04-04 14:40:09.319 EDT [ledgermgmt] initialize -> INFO 006 ledger mgmt initialized
# 2018-04-04 14:40:09.319 EDT [peer] func1 -> INFO 007 Auto-detected peer address: 9.236.236.104:7051
# 2018-04-04 14:40:09.319 EDT [peer] func1 -> INFO 008 Host is 0.0.0.0 , falling back to auto-detected address: 9.236.236.104:7051
# 2018-04-04 14:40:09.320 EDT [peer] func1 -> INFO 009 Auto-detected peer address: 9.236.236.104:7051
# 2018-04-04 14:40:09.320 EDT [peer] func1 -> INFO 00a Host is 0.0.0.0 , falling back to auto-detected address: 9.236.236.104:7051
# 2018-04-04 14:40:09.321 EDT [eventhub_producer] start -> INFO 00b Event processor started
# 2018-04-04 14:40:09.322 EDT [nodeCmd] computeChaincodeEndpoint -> INFO 00c Entering computeChaincodeEndpoint with peerHostname: 9.236.236.104
# 2018-04-04 14:40:09.322 EDT [nodeCmd] computeChaincodeEndpoint -> INFO 00d Exit with ccEndpoint: 9.236.236.104:7052
# 2018-04-04 14:40:09.322 EDT [nodeCmd] createChaincodeServer -> WARN 00e peer.chaincodeListenAddress is not set, using 9.236.236.104:7052
# 2018-04-04 14:40:09.323 EDT [chaincode] NewChaincodeSupport -> INFO 00f Chaincode support using peerAddress: 9.236.236.104:7052
# 2018-04-04 14:40:09.324 EDT [sccapi] registerSysCC -> INFO 010 system chaincode cscc(github.com/hyperledger/fabric/core/scc/cscc) registered
# 2018-04-04 14:40:09.324 EDT [sccapi] registerSysCC -> INFO 011 system chaincode lscc(github.com/hyperledger/fabric/core/scc/lscc) registered
# 2018-04-04 14:40:09.324 EDT [sccapi] registerSysCC -> INFO 012 system chaincode escc(github.com/hyperledger/fabric/core/scc/escc) registered
# 2018-04-04 14:40:09.324 EDT [sccapi] registerSysCC -> INFO 013 system chaincode vscc(github.com/hyperledger/fabric/core/scc/vscc) registered
# 2018-04-04 14:40:09.324 EDT [sccapi] registerSysCC -> INFO 014 system chaincode qscc(github.com/hyperledger/fabric/core/chaincode/qscc) registered
# 2018-04-04 14:40:09.325 EDT [gossip/service] func1 -> INFO 015 Initialize gossip with endpoint 9.236.236.104:7051 and bootstrap set [127.0.0.1:7051]
# 2018-04-04 14:40:09.326 EDT [msp] DeserializeIdentity -> INFO 016 Obtaining identity
# 2018-04-04 14:40:09.328 EDT [gossip/discovery] NewDiscoveryService -> INFO 017 Started { [] [75 73 192 103 212 187 164 81 62 213 160 17 133 17 137 184 22 175 53 48 193 157 219 134 42 99 249 53 245 56 238 79] 9.236.236.104:7051 <nil> <nil>} incTime is 1522867209328085921
# 2018-04-04 14:40:09.328 EDT [gossip/gossip] NewGossipService -> INFO 018 Creating gossip service with self membership of { [] [75 73 192 103 212 187 164 81 62 213 160 17 133 17 137 184 22 175 53 48 193 157 219 134 42 99 249 53 245 56 238 79] 9.236.236.104:7051 <nil> <nil>}
# 2018-04-04 14:40:09.329 EDT [gossip/gossip] NewGossipService -> WARN 019 External endpoint is empty, peer will not be accessible outside of its organization
# 2018-04-04 14:40:09.329 EDT [gossip/gossip] start -> INFO 01a Gossip instance 9.236.236.104:7051 started
# 2018-04-04 14:40:09.329 EDT [cscc] Init -> INFO 01b Init CSCC
# 2018-04-04 14:40:09.330 EDT [sccapi] deploySysCC -> INFO 01c system chaincode cscc/(github.com/hyperledger/fabric/core/scc/cscc) deployed
# 2018-04-04 14:40:09.330 EDT [sccapi] deploySysCC -> INFO 01d system chaincode lscc/(github.com/hyperledger/fabric/core/scc/lscc) deployed
# 2018-04-04 14:40:09.330 EDT [escc] Init -> INFO 01e Successfully initialized ESCC
# 2018-04-04 14:40:09.330 EDT [sccapi] deploySysCC -> INFO 01f system chaincode escc/(github.com/hyperledger/fabric/core/scc/escc) deployed
# 2018-04-04 14:40:09.330 EDT [sccapi] deploySysCC -> INFO 020 system chaincode vscc/(github.com/hyperledger/fabric/core/scc/vscc) deployed
# 2018-04-04 14:40:09.330 EDT [qscc] Init -> INFO 021 Init QSCC
# 2018-04-04 14:40:09.330 EDT [sccapi] deploySysCC -> INFO 022 system chaincode qscc/(github.com/hyperledger/fabric/core/chaincode/qscc) deployed
# 2018-04-04 14:40:09.330 EDT [nodeCmd] initSysCCs -> INFO 023 Deployed system chaincodes
# 2018-04-04 14:40:09.331 EDT [nodeCmd] serve -> INFO 024 Starting peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[9.236.236.104:7051]
# 2018-04-04 14:40:09.331 EDT [nodeCmd] serve -> INFO 025 Started peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[9.236.236.104:7051]
mkdir peer2
cp testdata/peer2-core.yaml peer2/core.yaml
cp -pr output/crypto peer2
FABRIC_CFG_PATH=$PWD/peer2 peer node start 2>&1 &
# 2018-04-04 14:44:27.906 EDT [msp] getMspConfig -> INFO 001 Loading NodeOUs
# 2018-04-04 14:44:27.922 EDT [nodeCmd] serve -> INFO 002 Starting peer:
# Version: 1.2.0-snapshot-3fd90a9c
# Go version: go1.10.1
# OS/Arch: darwin/amd64
# Experimental features: true
# Chaincode:
# Base Image Version: 0.4.6
# Base Docker Namespace: hyperledger
# Base Docker Label: org.hyperledger.fabric
# Docker Namespace: hyperledger
# 2018-04-04 14:44:27.922 EDT [ledgermgmt] initialize -> INFO 003 Initializing ledger mgmt
# 2018-04-04 14:44:27.922 EDT [kvledger] NewProvider -> INFO 004 Initializing ledger provider
# 2018-04-04 14:44:27.933 EDT [kvledger] NewProvider -> INFO 005 ledger provider Initialized
# 2018-04-04 14:44:27.933 EDT [ledgermgmt] initialize -> INFO 006 ledger mgmt initialized
# 2018-04-04 14:44:27.933 EDT [peer] func1 -> INFO 007 Auto-detected peer address: 9.236.236.104:8051
# 2018-04-04 14:44:27.933 EDT [peer] func1 -> INFO 008 Host is 0.0.0.0 , falling back to auto-detected address: 9.236.236.104:8051
# 2018-04-04 14:44:27.933 EDT [peer] func1 -> INFO 009 Auto-detected peer address: 9.236.236.104:8051
# 2018-04-04 14:44:27.933 EDT [peer] func1 -> INFO 00a Host is 0.0.0.0 , falling back to auto-detected address: 9.236.236.104:8051
# 2018-04-04 14:44:27.934 EDT [eventhub_producer] start -> INFO 00b Event processor started
# 2018-04-04 14:44:27.935 EDT [nodeCmd] computeChaincodeEndpoint -> INFO 00c Entering computeChaincodeEndpoint with peerHostname: 9.236.236.104
# 2018-04-04 14:44:27.935 EDT [nodeCmd] computeChaincodeEndpoint -> INFO 00d Exit with ccEndpoint: 9.236.236.104:7052
# 2018-04-04 14:44:27.936 EDT [nodeCmd] createChaincodeServer -> WARN 00e peer.chaincodeListenAddress is not set, using 9.236.236.104:7052
# 2018-04-04 14:44:27.937 EDT [chaincode] NewChaincodeSupport -> INFO 00f Chaincode support using peerAddress: 9.236.236.104:7052
# 2018-04-04 14:44:27.937 EDT [sccapi] registerSysCC -> INFO 010 system chaincode cscc(github.com/hyperledger/fabric/core/scc/cscc) registered
# 2018-04-04 14:44:27.937 EDT [sccapi] registerSysCC -> INFO 011 system chaincode lscc(github.com/hyperledger/fabric/core/scc/lscc) registered
# 2018-04-04 14:44:27.937 EDT [sccapi] registerSysCC -> INFO 012 system chaincode escc(github.com/hyperledger/fabric/core/scc/escc) registered
# 2018-04-04 14:44:27.937 EDT [sccapi] registerSysCC -> INFO 013 system chaincode vscc(github.com/hyperledger/fabric/core/scc/vscc) registered
# 2018-04-04 14:44:27.937 EDT [sccapi] registerSysCC -> INFO 014 system chaincode qscc(github.com/hyperledger/fabric/core/chaincode/qscc) registered
# 2018-04-04 14:44:27.938 EDT [gossip/service] func1 -> INFO 015 Initialize gossip with endpoint 9.236.236.104:8051 and bootstrap set [127.0.0.1:8051]
# 2018-04-04 14:44:27.940 EDT [msp] DeserializeIdentity -> INFO 016 Obtaining identity
# 2018-04-04 14:44:27.941 EDT [gossip/discovery] NewDiscoveryService -> INFO 017 Started { [] [206 130 233 152 152 200 89 129 18 22 78 62 85 217 120 222 30 180 247 97 143 100 119 104 195 188 122 13 6 58 45 204] 9.236.236.104:8051 <nil> <nil>} incTime is 1522867467941355359
# 2018-04-04 14:44:27.941 EDT [gossip/gossip] NewGossipService -> INFO 018 Creating gossip service with self membership of { [] [206 130 233 152 152 200 89 129 18 22 78 62 85 217 120 222 30 180 247 97 143 100 119 104 195 188 122 13 6 58 45 204] 9.236.236.104:8051 <nil> <nil>}
# 2018-04-04 14:44:27.942 EDT [gossip/gossip] NewGossipService -> WARN 019 External endpoint is empty, peer will not be accessible outside of its organization
# 2018-04-04 14:44:27.942 EDT [gossip/gossip] start -> INFO 01a Gossip instance 9.236.236.104:8051 started
# 2018-04-04 14:44:27.943 EDT [cscc] Init -> INFO 01b Init CSCC
# 2018-04-04 14:44:27.943 EDT [sccapi] deploySysCC -> INFO 01c system chaincode cscc/(github.com/hyperledger/fabric/core/scc/cscc) deployed
# 2018-04-04 14:44:27.943 EDT [sccapi] deploySysCC -> INFO 01d system chaincode lscc/(github.com/hyperledger/fabric/core/scc/lscc) deployed
# 2018-04-04 14:44:27.943 EDT [escc] Init -> INFO 01e Successfully initialized ESCC
# 2018-04-04 14:44:27.943 EDT [sccapi] deploySysCC -> INFO 01f system chaincode escc/(github.com/hyperledger/fabric/core/scc/escc) deployed
# 2018-04-04 14:44:27.944 EDT [sccapi] deploySysCC -> INFO 020 system chaincode vscc/(github.com/hyperledger/fabric/core/scc/vscc) deployed
# 2018-04-04 14:44:27.944 EDT [qscc] Init -> INFO 021 Init QSCC
# 2018-04-04 14:44:27.944 EDT [sccapi] deploySysCC -> INFO 022 system chaincode qscc/(github.com/hyperledger/fabric/core/chaincode/qscc) deployed
# 2018-04-04 14:44:27.944 EDT [nodeCmd] initSysCCs -> INFO 023 Deployed system chaincodes
# 2018-04-04 14:44:27.944 EDT [nodeCmd] serve -> INFO 024 Starting peer with ID=[name:"peer0.org2.example.com" ], network ID=[dev], address=[9.236.236.104:8051]
# 2018-04-04 14:44:27.945 EDT [nodeCmd] serve -> INFO 025 Started peer with ID=[name:"peer0.org2.example.com" ], network ID=[dev], address=[9.236.236.104:8051]
#!/bin/bash -ex
### Begin synchronous goo
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer channel create -c testchannel -o 127.0.0.1:7050 -f output/testchannel.tx
# 2018-04-04 15:03:08.929 EDT [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
# 2018-04-04 15:03:08.933 EDT [msp] DeserializeIdentity -> INFO 009 Obtaining identity
# 2018-04-04 15:03:08.934 EDT [msp] DeserializeIdentity -> INFO 00a Obtaining identity
# 2018-04-04 15:03:08.936 EDT [msp] DeserializeIdentity -> INFO 00b Obtaining identity
# 2018-04-04 15:03:08.940 EDT [channelCmd] InitCmdFactory -> INFO 002 Endorser and orderer connections initialized
# 2018-04-04 15:03:08.941 EDT [fsblkstorage] newBlockfileMgr -> INFO 00c Getting block information from block storage
# 2018-04-04 15:03:08.944 EDT [orderer/commmon/multichannel] newChain -> INFO 00d Created and starting new chain testchannel
# 2018-04-04 15:03:09.146 EDT [msp] DeserializeIdentity -> INFO 00e Obtaining identity
# 2018-04-04 15:03:09.147 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer channel fetch 0 -o 127.0.0.1:7050 -c testchannel peer1/testchannel.block
# 2018-04-04 15:06:56.965 EDT [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
# 2018-04-04 15:06:56.966 EDT [main] main -> INFO 002 Exiting.....
# 2018-04-04 15:06:56.968 EDT [common/deliver] Handle -> WARN 010 Error reading from 127.0.0.1:60636: rpc error: code = Canceled desc = context canceled
FABRIC_CFG_PATH=$PWD/peer2 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp peer channel fetch 0 -o 127.0.0.1:7050 -c testchannel peer2/testchannel.block
# 2018-04-04 15:08:29.418 EDT [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
# 2018-04-04 15:08:29.419 EDT [msp] DeserializeIdentity -> INFO 011 Obtaining identity
# 2018-04-04 15:08:29.420 EDT [main] main -> INFO 002 Exiting.....
# 2018-04-04 15:08:29.422 EDT [common/deliver] Handle -> WARN 012 Error reading from 127.0.0.1:60639: rpc error: code = Canceled desc = context canceled
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer channel join -b peer1/testchannel.block
# 2018-04-04 15:09:21.591 EDT [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
# 2018-04-04 15:09:21.593 EDT [ledgermgmt] CreateLedger -> INFO 026 Creating ledger [testchannel] with genesis block
# 2018-04-04 15:09:21.594 EDT [fsblkstorage] newBlockfileMgr -> INFO 027 Getting block information from block storage
# 2018-04-04 15:09:21.596 EDT [kvledger] CommitWithPvtData -> INFO 028 Channel [testchannel]: Committed block [0] with 1 transaction(s)
# 2018-04-04 15:09:21.597 EDT [ledgermgmt] CreateLedger -> INFO 029 Created ledger [testchannel] with genesis block
# 2018-04-04 15:09:21.601 EDT [cscc] Init -> INFO 02a Init CSCC
# 2018-04-04 15:09:21.601 EDT [sccapi] deploySysCC -> INFO 02b system chaincode cscc/testchannel(github.com/hyperledger/fabric/core/scc/cscc) deployed
# 2018-04-04 15:09:21.601 EDT [sccapi] deploySysCC -> INFO 02c system chaincode lscc/testchannel(github.com/hyperledger/fabric/core/scc/lscc) deployed
# 2018-04-04 15:09:21.601 EDT [escc] Init -> INFO 02d Successfully initialized ESCC
# 2018-04-04 15:09:21.601 EDT [sccapi] deploySysCC -> INFO 02e system chaincode escc/testchannel(github.com/hyperledger/fabric/core/scc/escc) deployed
# 2018-04-04 15:09:21.601 EDT [sccapi] deploySysCC -> INFO 02f system chaincode vscc/testchannel(github.com/hyperledger/fabric/core/scc/vscc) deployed
# 2018-04-04 15:09:21.601 EDT [qscc] Init -> INFO 030 Init QSCC
# 2018-04-04 15:09:21.601 EDT [sccapi] deploySysCC -> INFO 031 system chaincode qscc/testchannel(github.com/hyperledger/fabric/core/chaincode/qscc) deployed
# 2018-04-04 15:09:21.601 EDT [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
# 2018-04-04 15:09:21.601 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer2 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp peer channel join -b peer2/testchannel.block
# 2018-04-04 15:10:02.326 EDT [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
# 2018-04-04 15:10:02.328 EDT [ledgermgmt] CreateLedger -> INFO 025 Creating ledger [testchannel] with genesis block
# 2018-04-04 15:10:02.330 EDT [fsblkstorage] newBlockfileMgr -> INFO 026 Getting block information from block storage
# 2018-04-04 15:10:02.333 EDT [kvledger] CommitWithPvtData -> INFO 027 Channel [testchannel]: Committed block [0] with 1 transaction(s)
# 2018-04-04 15:10:02.334 EDT [ledgermgmt] CreateLedger -> INFO 028 Created ledger [testchannel] with genesis block
# 2018-04-04 15:10:02.338 EDT [cscc] Init -> INFO 029 Init CSCC
# 2018-04-04 15:10:02.338 EDT [sccapi] deploySysCC -> INFO 02a system chaincode cscc/testchannel(github.com/hyperledger/fabric/core/scc/cscc) deployed
# 2018-04-04 15:10:02.338 EDT [sccapi] deploySysCC -> INFO 02b system chaincode lscc/testchannel(github.com/hyperledger/fabric/core/scc/lscc) deployed
# 2018-04-04 15:10:02.338 EDT [escc] Init -> INFO 02c Successfully initialized ESCC
# 2018-04-04 15:10:02.338 EDT [sccapi] deploySysCC -> INFO 02d system chaincode escc/testchannel(github.com/hyperledger/fabric/core/scc/escc) deployed
# 2018-04-04 15:10:02.338 EDT [sccapi] deploySysCC -> INFO 02e system chaincode vscc/testchannel(github.com/hyperledger/fabric/core/scc/vscc) deployed
# 2018-04-04 15:10:02.338 EDT [qscc] Init -> INFO 02f Init QSCC
# 2018-04-04 15:10:02.338 EDT [sccapi] deploySysCC -> INFO 030 system chaincode qscc/testchannel(github.com/hyperledger/fabric/core/chaincode/qscc) deployed
# 2018-04-04 15:10:02.339 EDT [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
# 2018-04-04 15:10:02.339 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp GOPATH=$PWD/testdata/chaincode peer chaincode install -n mycc -v 1.0 -p simple/cmd
# 2018-04-04 15:12:40.298 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:12:40.299 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# 2018-04-04 15:12:40.672 EDT [lscc] executeInstall -> INFO 032 Installed Chaincode [mycc] Version [1.0] to peer
# 2018-04-04 15:12:40.673 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer2 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp GOPATH=$PWD/testdata/chaincode peer chaincode install -n mycc -v 1.0 -p simple/cmd
# 2018-04-04 15:13:16.759 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:13:16.759 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# 2018-04-04 15:13:17.134 EDT [lscc] executeInstall -> INFO 031 Installed Chaincode [mycc] Version [1.0] to peer
# 2018-04-04 15:13:17.134 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer chaincode instantiate -n mycc -v 1.0 -o 127.0.0.1:7050 -C testchannel -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
# 2018-04-04 15:15:22.562 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:15:22.562 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# 2018-04-04 15:15:22.910 EDT [main] main -> INFO 003 Exiting.....
sleep 5
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer chaincode list --installed -C testchannel
# Get installed chaincodes on peer:
# Name: mycc, Version: 1.0, Path: simple/cmd, Id: 8c6968c1653904f4e5e170547c8f214b7bd311eca5a076f20fc3d177f9a733a9
# 2018-04-04 15:16:18.556 EDT [main] main -> INFO 001 Exiting.....
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer chaincode list --instantiated -C testchannel
# Get instantiated chaincodes on channel testchannel:
# Name: mycc, Version: 1.0, Path: simple/cmd, Escc: escc, Vscc: vscc
# 2018-04-04 15:16:26.249 EDT [main] main -> INFO 001 Exiting.....
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer chaincode query -n mycc -v 1.0 -C testchannel -c '{"Args":["query","a"]}'
# 2018-04-04 15:18:59.656 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:18:59.657 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# Query Result: 100
# 2018-04-04 15:18:59.660 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp peer chaincode query -n mycc -v 1.0 -C testchannel -c '{"Args":["query","a"]}'
# 2018-04-04 15:19:39.959 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:19:39.959 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# Query Result: 100
# 2018-04-04 15:19:39.963 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer2 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp peer chaincode query -n mycc -v 1.0 -C testchannel -c '{"Args":["query","a"]}'
# 2018-04-04 15:20:36.383 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:20:36.383 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# 2018-04-04 15:20:36.396 EDT [golang-platform] GenerateDockerBuild -> INFO 034 building chaincode with ldflagsOpt: '-ldflags "-linkmode external -extldflags '-static'"'
# 2018-04-04 15:20:36.396 EDT [golang-platform] GenerateDockerBuild -> INFO 035 building chaincode with tags: experimental
# Query Result: 100
# 2018-04-04 15:20:47.096 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer2 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp peer chaincode query -n mycc -v 1.0 -C testchannel -c '{"Args":["query","a"]}'
# 2018-04-04 15:21:24.053 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:21:24.053 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# Query Result: 100
# 2018-04-04 15:21:24.057 EDT [main] main -> INFO 003 Exiting.....
FABRIC_CFG_PATH=$PWD/peer1 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp peer chaincode invoke -o 127.0.0.1:7050 -n mycc -C testchannel -c '{"Args":["invoke","a","b","10"]}'
#2018-04-04 15:59:55.160 EDT [msp] getMspConfig -> INFO 001 Loading NodeOUs
#2018-04-04 15:59:55.179 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default escc
#2018-04-04 15:59:55.179 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default vscc
#2018-04-04 15:59:55.185 EDT [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 004 Chaincode invoke successful. result: status:200
#2018-04-04 15:59:55.185 EDT [main] main -> INFO 005 Exiting.....
#
# 2018-04-04 15:59:55 ⌚ |2.2.4| cfdojo-2 in ~/workspace/fabric/testme
#○ → 2018-04-04 15:59:57.191 EDT [kvledger] CommitWithPvtData -> INFO 034 Channel [testchannel]: Committed block [2] with 1 transaction(s)
#2018-04-04 15:59:57.191 EDT [kvledger] CommitWithPvtData -> INFO 035 Channel [testchannel]: Committed block [2] with 1 transaction(s)
FABRIC_CFG_PATH=$PWD/peer2 CORE_PEER_MSPCONFIGPATH=crypto/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp peer chaincode query -n mycc -v 1.0 -C testchannel -c '{"Args":["query","a"]}'
# 2018-04-04 15:21:24.053 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
# 2018-04-04 15:21:24.053 EDT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
# Query Result: 100
# 2018-04-04 15:21:24.057 EDT [main] main -> INFO 003 Exiting.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment