parameters: (self, request)
docstring: Create Channel
          :param request: create parameter
          :return: Channel ID
          :rtype: uuid
docstring_summary: Create Channel
          :param request: create parameter
          :return: Channel ID
          :rtype: uuid
docstring_tokens: Create Channel : param request : create parameter : return : Channel ID : rtype : uuid
function: def create(self, request):
          """
          Create Channel
          :param request: create parameter
          :return: Channel ID
          :rtype: uuid
          """
  
          serializer = ChannelCreateBody(data=request.data)
          if serializer.is_valid(raise_exception=True):
              name = serializer.validated_data.get("name")
              peers = serializer.validated_data.get("peers")
              orderers = serializer.validated_data.get("orderers")
  
              try:
                  org = request.user.organization
                  ConfigTX(org.network.name).createChannel(name, [org.name])
                  ConfigTxGen(org.network.name).channeltx(profile=name, channelid=name, outputCreateChannelTx="{}.tx".format(name))
                  tx_path = "{}/{}/channel-artifacts/{}.tx".format(CELLO_HOME, org.network.name, name)
                  block_path = "{}/{}/channel-artifacts/{}.block".format(CELLO_HOME, org.network.name, name)
                  ordering_node = Node.objects.get(id=orderers[0])
                  peer_node = Node.objects.get(id=peers[0])
                  envs = init_env_vars(peer_node,org)
                  peer_channel_cli = PeerChannel("v2.2.0", **envs)
                  peer_channel_cli.create(
                      channel=name,
                      orderer_url= "{}.{}:{}".format(ordering_node.name,org.name.split(".", 1)[1], str(7050)),
                      channel_tx=tx_path,
                      output_block=block_path
                  )
                  for i in range(len(peers)):
                      peer_node =  Node.objects.get(id=peers[i])
                      envs = init_env_vars(peer_node,org)
                      #envs["CORE_PEER_LOCALMSPID"] = '{}MSP'.format(peer_node.name.split(".")[0].capitalize()) #Org1MSP
                      join_peers(envs,block_path)
                  
                  channel = Channel(
                      name=name,
                      network=org.network
                  )
                  channel.save()
                  channel.organizations.add(org)
                  channel.orderers.add(ordering_node)
                  response = ChannelIDSerializer(data=channel.__dict__)
                  if response.is_valid(raise_exception=True):
                      return Response(
                          ok(response.validated_data), status=status.HTTP_201_CREATED
                      )
              except Exception as e:
                  return Response(
                      err(e.args), status=status.HTTP_400_BAD_REQUEST
                  )
function_tokens: def create ( self , request ) : serializer = ChannelCreateBody ( data = request . data ) if serializer . is_valid ( raise_exception = True ) : name = serializer . validated_data . get ( "name" ) peers = serializer . validated_data . get ( "peers" ) orderers = serializer . validated_data . get ( "orderers" ) try : org = request . user . organization ConfigTX ( org . network . name ) . createChannel ( name , [ org . name ] ) ConfigTxGen ( org . network . name ) . channeltx ( profile = name , channelid = name , outputCreateChannelTx = "{}.tx" . format ( name ) ) tx_path = "{}/{}/channel-artifacts/{}.tx" . format ( CELLO_HOME , org . network . name , name ) block_path = "{}/{}/channel-artifacts/{}.block" . format ( CELLO_HOME , org . network . name , name ) ordering_node = Node . objects . get ( id = orderers [ 0 ] ) peer_node = Node . objects . get ( id = peers [ 0 ] ) envs = init_env_vars ( peer_node , org ) peer_channel_cli = PeerChannel ( "v2.2.0" , * * envs ) peer_channel_cli . create ( channel = name , orderer_url = "{}.{}:{}" . format ( ordering_node . name , org . name . split ( "." , 1 ) [ 1 ] , str ( 7050 ) ) , channel_tx = tx_path , output_block = block_path ) for i in range ( len ( peers ) ) : peer_node = Node . objects . get ( id = peers [ i ] ) envs = init_env_vars ( peer_node , org ) #envs["CORE_PEER_LOCALMSPID"] = '{}MSP'.format(peer_node.name.split(".")[0].capitalize()) #Org1MSP join_peers ( envs , block_path ) channel = Channel ( name = name , network = org . network ) channel . save ( ) channel . organizations . add ( org ) channel . orderers . add ( ordering_node ) response = ChannelIDSerializer ( data = channel . __dict__ ) if response . is_valid ( raise_exception = True ) : return Response ( ok ( response . validated_data ) , status = status . HTTP_201_CREATED ) except Exception as e : return Response ( err ( e . args ) , status = status . HTTP_400_BAD_REQUEST )