       id-bytes (.setIdBytes (ByteString/copyFromUtf8 id-bytes))
       true (.build))))
 
-
 (defn make-serialized-identity
   [& {:keys [mspid id-bytes]}]
   (map->SerializedIdentity {:mspid mspid :id-bytes id-bytes}))

   {:data
    {:data
     {:fn #(Common$Envelope/parseFrom ^ByteString %)
      :next
      {:payload
       {:data {:fn #(TransactionPackage$Transaction/parseFrom ^ByteString %)
               :next {:actions
                      {;;:header
                       :payload {:fn #(TransactionPackage$ChaincodeActionPayload/parseFrom ^ByteString %)
                                 :next {:chaincode-proposal-payload
                                        {:fn #(ProposalResponsePackage$ProposalResponsePayload/parseFrom ^ByteString %)
                                         :next {:extension {:fn #(ProposalPackage$ChaincodeAction/parseFrom ^ByteString %)
                                                            ;; NB: name is ':events' but in case of ChaincodeEvent, it is an event
                                                            :next {:events {:fn #(ChaincodeEventPackage$ChaincodeEvent/parseFrom ^ByteString %)
                                                                            :next nil}}}}}
                                        ;;:action ??
                                        ;;{:proposal-response-payload }
                                        }}}}}}}}}}

   :envelope-for-config-update
   {:payload {:data {:fn #(Configtx$ConfigUpdateEnvelope/parseFrom ^ByteString %)
                     :next {:config-update {:fn #(Configtx$ConfigUpdate/parseFrom ^ByteString %)}}}}}})

(extend-protocol IProtoToClj


(defrecord ChaincodeEvent [^String chaincode-id ^String tx-id ^String event-name ^bytes payload])
(defn make-chaincode-event
  [& {:keys [chaincode-id tx-id event-name payload]}]
  (map->ChaincodeEvent {:chaincode-id chaincode-id :tx-id tx-id :event-name event-name
                        :payload payload}))

(defrecord ProposalResponsePayload [^bytes proposal-hash ^bytes extension])
(defn make-proposal-response-payload
