two channels with the same chaincode


Nikos Karamolegkos
 

Or to package only if a new chaincode name/label is created. Thus, to keep the same package when I just update a chaincode (i.e only increase the sequence number, and sync with the new docker image for CaaS)


Nikos Karamolegkos
 

Thank you. It is a bit confusing with the chaincode name and chaincode label. Nevertheless, is it bad to package each time the chaincode before the deployment? Even the chaincode name is the same?


Matthew White
 

Hello,

 

The label is packaged with the chaincode, and is used to prefix a sha hash  of the packaged file this makes the “packageid” (aka “chaincodeid”).

 

The chaincode name isn’t in the packaged code, and is associated with the package id at approval time.

More than one chaincode name can be associated with the same packageid/chaincodeid.

 

Within the context a single peer, it will have/expect running chaincode ‘images’ on a 1:1 basis with the chaincodeids.

 

The same chaincode name *should* be usable on different channels irrespective of peer… have you seen differently?

 

Thanks Matthew

From: fabric@... <fabric@...> On Behalf Of Nikos Karamolegkos
Sent: 07 September 2022 09:34
To: fabric@...
Subject: [EXTERNAL] Re: [Hyperledger Fabric] two channels with the same chaincode

 

Also, If I have already packaged my chaincode to tar. gz file with PACKAGE_ID= abcdf and I would like to use the same chaincode to a new channel (same chaincode functionality but different chaincode name and label - given that I can not use the

ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

ZjQcmQRYFpfptBannerEnd

Also, If I have already packaged my chaincode to tar.gz file with PACKAGE_ID= abcdf and I would like to use the same chaincode to a new channel (same chaincode functionality but different chaincode name and label - given that I can not use the same chaincode name to different channels where the same peers are joined -) I have to package it again (i.e create new tar.gz file). Correct?

Unless otherwise stated above:

IBM United Kingdom Limited
Registered in England and Wales with number 741598
Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU


Nikos Karamolegkos
 

Also, If I have already packaged my chaincode to tar.gz file with PACKAGE_ID= abcdf and I would like to use the same chaincode to a new channel (same chaincode functionality but different chaincode name and label - given that I can not use the same chaincode name to different channels where the same peers are joined -) I have to package it again (i.e create new tar.gz file). Correct?


Nikos Karamolegkos
 

I think it is better to get the second option. I don't know which builder I am using. I deploy the chaincode as a service


Matthew White
 

Hello;

 

Could you just confirm which chaincode builder you are using?  There are a few different ones 😊

 

Essentially I think you’ve two options

 

  • Use the same chaincode docker image, but when it’s launched in K8S set an environment variable on the deployment. That could be used to switch the logic inside the code
  • When transactions are sent to the, add another argument to the transactions you call. Thereby switching your logic (using the new value

 

 

Cheers, Matthew

From: fabric@... <fabric@...> On Behalf Of Nikos Karamolegkos
Sent: 05 September 2022 10:47
To: fabric@...
Subject: [EXTERNAL] Re: [Hyperledger Fabric] two channels with the same chaincode

 

function or parameter? Can you give me an example? _. _,_. _,_ Links: You receive all messages sent to this group. View/Reply Online (#11449) | Reply To Sender | Reply To Group | Mute This Topic | New Topic Your Subscription ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍

ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

ZjQcmQRYFpfptBannerEnd

function or parameter? Can you give me an example?

Unless otherwise stated above:

IBM United Kingdom Limited
Registered in England and Wales with number 741598
Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU


Nikos Karamolegkos
 

function or parameter? Can you give me an example?


Yacov
 

why not just pass the parameter as a function into the same chaincode?


From: fabric@... <fabric@...> on behalf of Nikos Karamolegkos <nkaram@...>
Sent: Monday, September 5, 2022 11:42 AM
To: fabric@... <fabric@...>
Subject: [EXTERNAL] Re: [Hyperledger Fabric] two channels with the same chaincode
 
I am using hlf-operator with the chaincode builder. Thank you for your proposals. So I have to keep one chaincode pod per channel although the functionality of the chaincodes are the same. Correct? Let me extend my question. Let's say that I
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd
I am using hlf-operator with the chaincode builder. Thank you for your proposals. So I have to keep one chaincode pod per channel although the functionality of the chaincodes are the same. Correct? Let me extend my question. Let's say that I have two channels that use exactly the same chaincode code (i.e same functionality) but there is a small difference to a value of the code (e.g chaincode 1 has threshold value=10, chaincode 2 has threshold value=20), thus can I have  a docker image in order to create two different pods where the threshold value can be set by a ENV? In order to avoid build the same image again again just because one variable changed


Nikos Karamolegkos
 

I am using hlf-operator with the chaincode builder. Thank you for your proposals. So I have to keep one chaincode pod per channel although the functionality of the chaincodes are the same. Correct? Let me extend my question. Let's say that I have two channels that use exactly the same chaincode code (i.e same functionality) but there is a small difference to a value of the code (e.g chaincode 1 has threshold value=10, chaincode 2 has threshold value=20), thus can I have  a docker image in order to create two different pods where the threshold value can be set by a ENV? In order to avoid build the same image again again just because one variable changed


jkneubuh@...
 

Hi Nikos,

Sharing the CCaaS endpoint across multiple channels is asking for trouble.  It _may_ work, but it seems like it's an invitation for unexpected problems if and when the states collide across the peer's notion of chaincode scope.

As an alternate option... strongly consider migrating from CCaaS to the new Kubernetes Chaincode Builder to help keep everything organized.  This will allow you to prepare one docker image and one chaincode package (bound to the immutable layer digest for the routine) for your smart contract.   The k8s-builder does a good job of juggling and sorting out pods based on the org, cc label, channel, etc. at which the contract is committed to the ledger.

Some notes on the k8s-builder CC installation flow are available at the Full Stack Asset Transfer Guide, illustrating in one case how a contract package can be published to a web server and linked to a Docker build pipeline.

Also note that the k8s-builder is supported natively by the modern k8s operators, both fabric-operator and hlf-operator provide built-in support for the new CC deployment mechanisms.

-josh


Nikos Karamolegkos
 

Any help on that?


Nikos Karamolegkos
 

Hello,

I have a network with some peer organizations (2 peers each organization) and one orderer organization (with 3 orderer nodes), let's call them consortium. Each time a new channel is created this consortium join the new channel and a default chaincode is installed to the new channel (theoretically, because practically/physically the chaincode is installed to peers). Each time I change the chaincode label (and name) in order to be distinct for the peers which have multiple chaincodes installed (one for each channel). The chaincode is deployed as an external service, and I am wondering If I can have the same chaincode label and name for all the channels installed only once to the peers ?(as it is the same for all channels, the only thing that changes is the ledger after different transactions)

Thanks,

-- 
Nikos Karamolegkos
R & D engineer at ICS-FORTH
Telecommunications and Networks Lab (TNL)