Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.9 KB

README.md

File metadata and controls

45 lines (29 loc) · 1.9 KB

Corda

Contract and State Upgrades CorDapp

This CorDapp shows the end-to-end process of upgrading contracts & state simultaneously in Corda.

The upgrade takes place in four stages:

  1. Create a replacement contract and state implementing the UpgradedContract interface
  2. Bundle the replacement contract and state into a CorDapp and install it on each node
  3. For each state you wish to upgrade the contract of, authorise the contract and state upgrade for that state on each node
  4. On a single node, authorise the upgrade for each state you wish to upgrade the contract and state of

Pre-requisites:

See https://docs.corda.net/getting-set-up.html.

Usage

Running the nodes:

See https://docs.corda.net/tutorial-cordapp.html#running-the-example-cordapp.

Upgrading the contract and state:

Run the following command from the project's root folder:

  • Unix/Mac OSX: ./gradlew runUpgradeContractStateClient
  • Windows: gradlew runUpgradeContractStateClient

This will run the contract and state upgrade client defined HERE. This client will:

  1. Connect to PartyA and PartyB's nodes via RPC
  2. Issue a state with the old contract
  3. Upgrade the state to use the new contract and state
  4. Wait ten seconds for the upgrade to propagate
  5. Log the state to show that its contract and state has been upgraded

You should see a message of the form:

```I 09:47:54 1 UpgradeContractStateClient.main - TransactionState(data=NewState(a=O=PartyA, L=London, C=GB, b=O=PartyB, L=New York, C=US, value=1), contract=com.upgrade.NewCon
   tractAndState, notary=O=Notary, L=London, C=GB, encumbrance=null, constraint=net.corda.core.contracts.WhitelistedByZoneAttachmentConstraint@649b5891)```