Exemple #1
0
def createInvokeProposalForBDD(ccSpec, chainID, signersCert, Mspid, type):
	"Returns a deployment proposal of chaincode type"
	lc_chaincode_invocation_spec = chaincode_pb2.ChaincodeInvocationSpec(chaincodeSpec = ccSpec)

	# Create
	ccHdrExt = chaincode_proposal_pb2.ChaincodeHeaderExtension(chaincodeID=ccSpec.chaincodeID)

	ccProposalPayload = chaincode_proposal_pb2.ChaincodeProposalPayload(Input=lc_chaincode_invocation_spec.SerializeToString())

	bootstrapHelper = bootstrap_util.BootstrapHelper(chainId=chainID)

	chainHdr = bootstrapHelper.makeChainHeader(type=common_dot_common_pb2.HeaderType.Value(type),
											   txID=bootstrap_util.GetUUID(), extension=ccHdrExt.SerializeToString())
	serializedIdentity = identities_pb2.SerializedIdentity(Mspid=Mspid, IdBytes=crypto.dump_certificate(crypto.FILETYPE_PEM, signersCert))


	sigHdr = bootstrapHelper.makeSignatureHeader(serializedIdentity.SerializeToString(), bootstrap_util.BootstrapHelper.getNonce())

	header = common_dot_common_pb2.Header(chainHeader=chainHdr, signatureHeader=sigHdr)

	# make proposal
	proposal = proposal_pb2.Proposal(header=header.SerializeToString(), payload=ccProposalPayload.SerializeToString())


	return proposal
Exemple #2
0
 def getBootrapHelper(self, chainId):
     import bootstrap_util
     return bootstrap_util.BootstrapHelper(chainId=chainId)
 def get_bootstrap_helper(self):
     import bootstrap_util
     return bootstrap_util.BootstrapHelper()