Example #1
0
        public static TransactionProposal createInvokerProposal(TransRequest request, TransactionHeader transactionHeader)
        {
            var args = new RepeatedField <ByteString>();

            args.Add(Util.ConvertToByteString(request.Fcn));
            foreach (var item in request.Args)
            {
                args.Add(Util.ConvertToByteString(item));
            }
            var ccis = new ChaincodeSpec()
            {
                Type        = ChaincodeSpec.Types.Type.Undefined,
                ChaincodeId = new ChaincodeID()
                {
                    Name = request.ChaincodeId
                },
                Input = new ChaincodeInput()
                {
                    Args = args,
                }
            };
            var proposal = CreateChaincodeProposalWithTxIDNonceAndTransient(ccis, transactionHeader, request.TransientMap);
            var tp       = new TransactionProposal()
            {
                TxnID    = transactionHeader.Id,
                Proposal = proposal
            };

            return(tp);
        }
Example #2
0
        public static string CreateRequest(AppSetting config, TransRequest request)
        {
            var header      = new TransactionHeader(config.appInfo.MspId, request.EnrollmentCertificate, config.appInfo.ChannelId, request.IsSm3);
            var proposal    = createInvokerProposal(request, header);
            var pb_proposal = signProposal(proposal.Proposal, request.Sign);
            var res         = Util.Marshal(pb_proposal).ToBase64();

            return(res);
        }