vania-janet/multiturn-rag-retrieval-data huggingface dataset:
Deploy a smart contract using Fabric v2.x 

![version 2.x](https://cloud.ibm.com/docs-content/v1/content/c5288bed34c3820e3a5251d820ee91adcd2591a3/blockchain/images/2-x_Pill.png) Using the Hyperledger Fabric v2.x chaincode lifecycle, learn how to create and package a smart contract and how to propose the smart contract definition to channel members on a channel that runs application capability 2.x. Learn how to install the smart contract package on peers that run a Fabric 2.x image. Finally, see how channel members can approve and commit the smart contract definition to the channel.

While the terms "smart contract" and "chaincode" are often used interchangeably, "smart contracts" refers to the business logic that governs transactions and access to its data, while "chaincode" refers to the larger infrastructure of packages and other code that encompasses a smart contract.

If you prefer to continue to use the legacy smart contract deployment process, see [Deploy a smart contract using Fabric v1.4](https://cloud.ibm.com/docs/blockchain?topic=blockchain-ibp-console-smart-contracts-v14).

Instead of a single organization administrator making decisions for all organizations about when a smart contract is updated, what it contains, and where it runs, Fabric v2.0 introduced a new distributed process to manage the lifecycle of a smart contract that allows for decentralizing the governance of smart contracts on a channel. The process for installing, proposing, and updating a smart contract is known as the "lifecycle" of a smart contract. This lifecycle is necessarily ongoing, as it encompasses changes to the smart contract itself as well as updates to a channel, as for example when a new member starts using the smart contract, and is managed through a combination of processes inside and outside the console.

Lifecycle process overview

Attention! The IBM Blockchain Platform Extension for VS Code (VS Code extension) referenced throughout the documentation is an open-source project which is no longer active, and therefore not officially supported by IBM.
[job update](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-job-update) [app update](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-application-update) 



Working with secrets as environment variables is similar to working with configmaps as environment variables. When you work with secrets, the data is encoded.

Consider the following information when you update an app or job that has an environment variable that references configmaps or secrets.



* When you update an app or job that has an environment variable that fully references a configmap (or secret) to fully reference a different configmap (or secret), full references override other full references in the order in which they are set (the last referenced set overrides the first set).
* When you update an app or job that has an environment variable that references a key in one configmap (or secret) to reference the same key in a different configmap (or secret), then the last referenced key is used.
* When you update an app or job that has an environment variable that fully references a configmap (or secret) to add a reference to a specific key, then the specific key reference overrides the full configmap (or secret) reference.



For basic information about referencing configmaps or secrets with the CLI, see [Referencing configmaps with the CLI](https://cloud.ibm.com/docs/codeengine?topic=codeengine-configmapconfigmap-ref-cli) and [Referencing secrets with the CLI](https://cloud.ibm.com/docs/codeengine?topic=codeengine-secretsecret-ref-cli).

The following scenarios can be completed for secrets or configmaps.



 Referencing a full secret with the CLI 

Secrets and configmaps are made up of key-value pairs. Environment variables are the result of providing an entry per key when referencing the full secret or configmap.
2021/04/05 09:44:54 Terraform apply | sshcommand = ssh -J root@52.116.124.67  root@10.241.0.6
2021/04/05 09:44:54 Command finished successfully.
2021/04/05 09:45:00 Done with the workspace action

After the plan is successfully applied, it generates an sshcommand in the Outputs section in the Terraform code. You can use this command to log in to the IBM Spectrum Symphony cluster. If you specified IP addresses for ssh_allowed_ips property only, those IP address machines would be able to use this SSH command.





 Applying a plan using the API 



1. To apply a plan by using the IBM Cloud Schematics Python APIs, create a Python file and provide a name of your choice, for example, schematics_apply_plan.py.
2. Copy and paste the [Apply a plan using Schematics Python API](https://cloud.ibm.com/docs/hpc-spectrum-symphony?topic=hpc-spectrum-symphony-applying-plan&interface=apiexample-request-apply) example request to your Python file.
3. Change the following parameters as part of the request:



* Replace your IBM Cloud API key to the authenticator = IAMAuthenticator('<ibm-api-key>') variable.
* Change the API endpoint to the endpoint mentioned in [API endpoints](https://cloud.ibm.com/apidocs/schematics?code=pythonapi-endpoints) according to the location that you want your Schematics workspace to reside, for example, schematics_service.set_service_url('https://us.schematics.cloud.ibm.com').



4. Inside the schematics_service.apply_workspace_command function, provide the following parameters:
feature.getCurrentValue(entityId, entityAttributes); // returns the stringified yaml (check above table)





 Property usage example 

const property = client.getProperty('json-property');
property.getPropertyDataType(); // STRING
property.getPropertyDataFormat(); // JSON

// Example (traversing the returned JSON)
let result = property.getCurrentValue(entityId, entityAttributes);
console.log(result.key) // prints the value of the key

const property = client.getProperty('yaml-property');
property.getPropertyDataType(); // STRING
property.getPropertyDataFormat(); // YAML
property.getCurrentValue(entityId, entityAttributes); // returns the stringified yaml (check above table)





 Listen to the feature or property changes 

To listen to the data changes, add the following code in your application:

client.emitter.on('configurationUpdate', () => {
// add your code
})
From the Add prerequisites section, choose whether your product is a full stack or an extension. If your architecture is a full stack product, no further action is required.
2. If your product is an extension, click Add.
3. Enter or select the product that you want to add as a prerequisite.
4. Enter the required version or range of versions by using SemVer formatting. For example, ^1.0.0.
5. Select any required variations. If no specific variations are selected, all variations are listed as prerequisites.
6. Click Add > Next.









 Adding deployable architecture details by using the CLI 

If you included a catalog manifest file in your repository, deployable architecture details are automatically imported into the private catalog. If not, you can add an architecture diagram to your deployable architecture by using the console. To view the steps, see [Adding deployable architecture details by using the console](https://cloud.ibm.com/docs/secure-enterprise?topic=secure-enterprise-onboard-custom&interface=uicustom-solution-arch-ui).





 Adding the license requirements by using the console 

If users are required to accept any license agreements beyond the IBM Cloud Services Agreement, provide the URL to each agreement.

If you included a catalog manifest file in your repository, license requirement details were automatically imported into the private catalog. If not, complete the following steps:



1. From the Add license agreements section, click Add license.
2. Enter the name and URL of the license, and click Add license.
3. After entering all additional license agreements, click Next.







 Adding the license requirements by using the CLI 

If you included a catalog manifest file in your repository, license requirement details were automatically imported into the private catalog. If not, add license requirements to your deployable architecture by using the console. To view the steps, see [Adding license requirements by using the console](https://cloud.ibm.com/docs/secure-enterprise?topic=secure-enterprise-onboard-custom&interface=uicustom-cfg-license-ui).
.) _) / /( (_ )( / / ) _)
(____)_)__) ___/(__)_)__)(____)

Some Env Vars:
--------------
CE_APP=myapp
CE_DOMAIN=us-east.codeengine.appdomain.cloud
CE_SUBDOMAIN=abcdabcdab
HOME=/root
HOSTNAME=myapp-00001-deployment-5b5895fdf7-abcd
K_REVISION=myapp-00001
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PORT=8080
PWD=/
SHLVL=1
z=Set env var 'SHOW' to see all variables

You deployed your first application to Code Engine and tested it out. Go to the [Tutorial: Deploying applications](https://cloud.ibm.com/docs/codeengine?topic=codeengine-deploy-app-tutorial) or [Working with apps in Code Engine](https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloads) to try out more options for applications.





 Running your first Code Engine job 

Create and run your first Code Engine job by using the icr.io/codeengine/helloworld image.



1. Open the [Code Engine](https://cloud.ibm.com/codeengine/overview) console.
2. Select Start creating.
3. Select a project from the list of available projects. You can also [create a new one](https://cloud.ibm.com/docs/codeengine?topic=codeengine-manage-projectcreate-a-project). Note that you must have a selected project to create a job.
4. Select Job.
5.
You can customize how long the console waits for the installation to complete by changing the console settings with the [APIs](https://cloud.ibm.com/apidocs/blockchainedit-settings). See the fabric_lc_install_cc_timeout_ms setting. In some cases, it is the peer itself that is timing out and you need to override the peer configuration to extend its time out.



1. From the console, open the peer tile and click the Settings icon.
2. Click Edit configuration JSON (Advanced).
3. In the Configuration updates box paste the following text and click Update peer.

{
"chaincode":{
"startuptimeout":"300s",
"installTimeout":"600s",
"executetimeout":"30s"
}
}



The peer restarts and then you can retry the smart contract installation. Because the original installation failed you need to specify a new smart contract name and version.





 Why is my Node.js smart contract fail to endorse? 

 What’s happening 

My Node.js smart contract endorsement fails with the error:

Error: endorsement failure during query. response: status:500 message:"error in simulation: failed to execute transaction 6cbcf9f94bdef3fc68abba5604e46293ae: could not launch chaincode nodecc:1.1: error building chaincode: error building image: external builder failed: external builder failed to build: external builder 'ibp-builder' failed: exit status 3"

 Why it’s happening 

By default, a Fabric v1.4 peer creates a Node v8 runtime, and a Fabric v2.x peer creates a Node v12 runtime. In order for the smart contract to work with Node 12 runtime, the fabric-contract-api and fabric-shim node modules must be at v1.4.5 or greater.

 How to fix it
It does not add a configuration snippet annotation to the Ingress resources anymore. This change makes the add-on compatible with the default ALB configuration that disables the usage of snippet annotations.

Resolves [CVE-2022-24921](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2022-24921)





 Version 2.0.0_999, released on 28 February 2022. 



* [CVE-2022-23772](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2022-23772)
* [CVE-2022-23773](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2022-23773)
* [CVE-2022-23806](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2022-23806)







 Version 2.0.0_981, released on 10 February 2022. 

This version addresses an issue that causes periodic restarts for the managed OAuth2 Proxy deployments.





 Version 2.0.0_923, released on 26 January 2022. 



* [CVE-2021-44716](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2021-44716)
* [CVE-2021-44717](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2021-44717)







 Version 2.0.0_755, released on 19 November 2021. 



* [CVE-2021-41771](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2021-41771)
Code Engine deploys applications and runs jobs that are bundled into container images. If you do not have a container image, you can build and deploy your code from within Code Engine.

Code Engine runs functions as code bundles. If you do not have a code bundle, you can build and run your function from within Code Engine.

Do you have source code or a container image for your application or job?

I have a container image. Where is your image stored?



* If your image is stored in a [container registry](https://cloud.ibm.com/docs/codeengine?topic=codeengine-add-registry) that you have access to, then you are ready to deploy.
* If your image is in a private registry, either in a different Container Registry account or in private registry such as Docker Hub, you must [set up access](https://cloud.ibm.com/docs/codeengine?topic=codeengine-add-registry).



Then, you are ready to [deploy your application](https://cloud.ibm.com/docs/codeengine?topic=codeengine-learning-pathslp-deploy-app), [run your job](https://cloud.ibm.com/docs/codeengine?topic=codeengine-learning-pathslp-run-job), or [run your function](https://cloud.ibm.com/docs/codeengine?topic=codeengine-learning-pathslp-run-fun).

I have source code. How do I get started?



* Find out what advantages are available when you [build your image with Code Engine](https://cloud.ibm.com/docs/codeengine?topic=codeengine-faqsdockerbld-cebuild).
* [Plan for your build](https://cloud.ibm.com/docs/codeengine?topic=codeengine-plan-build).
* You can also find [tips for creating a Dockerfile](https://cloud.ibm.com/docs/codeengine?topic=codeengine-dockerfile).
No information was given for updating a load balancer instance with the ID you specified.





 load_balancer_update_conflict 

Message: The load balancer with ID <load_balancer_id> cannot be updated because its status is one of these:



* UPDATE_PENDING
* CREATE_PENDING
* DELETE_PENDING
* MAINTENANCE_PENDING



Try updating the load balancer when it is in ACTIVE status.





 member_duplicate_address_and_port 

Message: Member with address <member_address> and port <member_port> already exists in the pool.

Provide a unique member address and port combination in your request.





 member_invalid_address 

Message: The specified member IP address <member_ip> is invalid.

In your request, provide a valid IPv4 CIDR address for the member.





 member_invalid_port 

Message: The specified member port <member_port> is invalid.

Provide a valid port number. A valid port number is in the range from 1 to 65535.





 member_invalid_weight 

Message: The specified member weight <member_weight> is invalid.

Provide a valid member weight. The value must be an integer between 0 and 100.





 member_ip_not_found 

Message: Member with IP address <member_IP> does not belong to any subnets in the Region and VPC of the load balancer.

In your request, provide the address of a member that belongs to a subnet in same the Region and VPC as the load balancer.





 member_missing_address 

Message: Member address is missing.

Member address is a required field. Provide a value for member address.





 member_missing_protocol_port 

Message: Member port is missing.

Member port is a required field. Provide a value for member port.





 member_not_found 

Message: Member with ID <member_id> cannot be found.

Provide a member ID where the user has read access and read access to the subnet where the member resides.





 member_over_quota 

Message: Member cannot be created. Quota of member instances under the pool has reached maximum limit.
"_id": "74b2be56045bed0c8c9d24b939000dbe",
"_rev": "2-f796915a291b37254f6df8f6f3389121",
"name": "Samsung Galaxy S4",
"description": "",
"price": 600
}

At the same time, someone else, working with a replicated database, reduces the price. This change is made to the first version of the document. Therefore, the price reduction change doesn't "know" about the description change.

Later, when the two databases are replicated, it might not be clear which of the two alternative versions of the document is correct. This example is a conflict scenario.



 Get conflicting revisions 

To find any conflicting revisions for a document, retrieve that document as normal, but include the conflicts=true parameter, similar to the following example:

https://ACCOUNT.cloudant.com/products/$_ID?conflicts=true

See the following example response to document retrieval that shows conflicting revisions:

{
"_id":"74b2be56045bed0c8c9d24b939000dbe",
"_rev":"2-f796915a291b37254f6df8f6f3389121",
"name":"Samsung Galaxy S4",
"description":"",
"price":600,
"_conflicts":["2-61ae00e029d4f5edd2981841243ded13"]
}

If the document has any conflicts, you would get a response similar to the example provided, which is based on the changed description or changed price problem.

The version with the changed price was chosen arbitrarily as the latest version of the document. Do not assume that the most recently updated version of the document is the latest version for conflict resolution purposes.
"_rev": "2-61ae00e029d4f5edd2981841243ded13",
"name": "Samsung Galaxy S4",
"description": "Latest smartphone from Samsung",
"price": 650
}

At the same time, someone else - working with a replicated database - reduces the price.

See a different revision, conflicting with the previous one because of different price value:

{
"_id": "74b2be56045bed0c8c9d24b939000dbe",
"_rev": "2-f796915a291b37254f6df8f6f3389121",
"name": "Samsung Galaxy S4",
"description": "",
"price": 600
}

The two databases are then replicated. The difference in document versions results in a conflict.



 Get conflicting revisions 

You identify documents with conflicts by using the conflicts=true option.

See the following example of finding documents with conflicts:

https://$ACCOUNT.cloudant.com/products/$_ID?conflicts=true

See the following example response that shows conflicting revisions that affect documents:

{
"_id":"74b2be56045bed0c8c9d24b939000dbe",
"_rev":"2-f796915a291b37254f6df8f6f3389121",
"name":"Samsung Galaxy S4",
"description":"",
"price":600,
"_conflicts":["2-61ae00e029d4f5edd2981841243ded13"]
}

The version with the changed price was chosen arbitrarily as the latest version of the document. The conflict with another version is noted by providing the ID of that other version in the _conflicts array. In most cases, this array has only one element, but many conflicting revisions might exist.





 Merge the changes
"_conflicts":["2-61ae00e029d4f5edd2981841243ded13"]
}

If the document has any conflicts, you would get a response similar to the example provided, which is based on the changed description or changed price problem.

The version with the changed price was chosen arbitrarily as the latest version of the document. Do not assume that the most recently updated version of the document is the latest version for conflict resolution purposes.

In this example, consider a conflict between the retrieved document, which has the _rev value 2-f796915a291b37254f6df8f6f3389121, and another document, which has the _rev value 2-61ae00e029d4f5edd2981841243ded13. The conflicting document details are noted in the _conflicts array.

Often, you might find that the array has only one element, but it's possible for there to be many conflicting revisions. Each revision is listed in the array.





 Merge the changes 

Your application must identify all the potential changes, and reconcile them, effectively merging the correct and valid updates to produce a single, non-conflicting version of the document.

To compare the revisions and identify what changed, your application must retrieve all the versions from the database. You begin by retrieving a document and details of any conflicting versions. To start the retrieval, use a command similar to the following one, which also requests the _conflicts array:

https://$ACCOUNT.cloudant.com/products/$_ID?conflicts=true

This retrieval gives you a current version of the document that you store, and a list of all the other conflicting documents that must also be retrieved, for example ...rev=2-61ae00e029d4f5edd2981841243ded13 and ...rev=1-7438df87b632b312c53a08361a7c3299. Each of these other conflicting versions is also retrieved and stored, for example:
"issuance_info": {
"auto_rotated": false,
"bundle_certs": false,
"ca": "ca_config_name",
"challenges":
{
"domain": "domain1",
"expiration": "2022-09-20T06:21:36Z",
"status": "pending",
"txt_record_name": "_acme-challenge.domain1.",
"txt_record_value": "TA6J7fFYrwP3Jg-S_IAQSj2Ydqfw4Ycm4sMwlzuCcxk"
},
{
"domain": "domain2",
"expiration": "2022-09-20T06:21:36Z",
"status": "pending",
"txt_record_name": "_acme-challenge.domain2.",
"txt_record_value": "qSDrCkFAViX4xANKuEPcMNairWm1PUtROm6kp9bmSS0"
},
{
"domain": "domain3",
"expiration": "2022-09-20T06:21:36Z",
"status": "pending",
"txt_record_name": "_acme-challenge.domain3.",
"txt_record_value": "8dcgan91fW6aK3aIhPAVZRkHpbYEoMcCNPpVh1n4tSA"
}
],
"dns": "manual",
"ordered_on": "2022-09-13T06:21:33Z",
"state": 0,
"state_description": "Pre-activation"
},
"key_algorithm": "RSA2048",
"labels": ],
updated_at <br>date-time The date and time that this gateway was last updated. 





Table 4. Status codes

 Status code 

 200 The Transit Gateway was updated successfully. 
 400 The supplied Transit Gateway patch was invalid. 
 404 A Transit Gateway with the specified identifier could not be found. 
 409 The Transit Gateway could not be updated as there are pre-existing cross-region connections attached. 





 Example Response 

This response indicates that the transit gateway was updated successfully:

{
"created_at": "2020-03-31T12:08:05Z",
"crn": "crn:[...]",
"global": false,
"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4",
"location": "us-south",
"name": "example-gateway-new-name",
"resource_group": {
"id": "56969d6043e9465c883cb9f7363e78e8"
},
"status": "available",
"updated_at": "2020-03-31T12:08:05Z"
}

For more information (including Java, Node, Python and Go examples), see "Updates specified Transit Gateway" in the [Transit Gateway API reference](https://cloud.ibm.com/apidocs/transit-gatewayupdate-transit-gateway).









 Changing your configuration using the Terraform 

You can specify the following argument references for your resource when changing the configuration of your transit gateway using Terraform:



Table 1. Terraform argument references for changing the configuration

 Argument Details 

 name <br>Required <br>Boolean The unique user-defined name for the gateway. For example, myGateway 
 global <br>Required <br>Boolean The gateways with global routing (true) to connect to the networks outside their associated region. 





 Example 

This example illustrates changing the configuration of your transit gateway: