Could you please let me know how a CORDA Notary is created .
In the gradle file I was able to find the following .
deployNodes(){
name "O=NetworkMapAndNotary,L=London,C=GB"
notary = [validating : true]
p2pPort 10002
cordapps = []
}
Is the above only needed step to create a Notary . I searched in the documentation , but was not able to find much details .
So if we want to have multiple notaries , how to configure and wire them together ?
Here is the tutorial on implementing a custom notary: https://docs.corda.net/tutorial-custom-notary.html.
Please note that this is still an experimental feature, and the API is likely to change.
Related
I have a Corda Infrastructure with some nodes and a (not validating) notary. They're all using a Network Map for the compatibility zone, and all the corda nodes, including the notary, download the same network-parameters file.
When executing a flow, Corda gives me an Exception because the Notary is not on the network parameters whitelist. I cannot find anything anything about that on R3 Documentation.
java.lang.IllegalStateException: Notary [O=Notary, L=Cosenza, C=IT (owningKey = DLAdtNkbnrjn6FGwzE4sCaiDS3tRgMw3KhZfA7bD3icYK1)] specified by the transaction is not on the network parameter whitelist: []
at net.corda.core.internal.TransactionUtilsKt.checkNotaryWhitelisted(TransactionUtils.kt:257) ~[corda-core-4.8.jar:?]
Note that I'm using a fixed Notary X500 Name in the Flow code instead of "preferredNotary" because it won't be found. I think it is because of the same problem.
Do I have to do something explicit to add Notary in network parameters whitelist?
Do I have to do something explicit to add Notary in network parameters whitelist?
Yeah you do. Since you are using a network-map-service your node will get its network-parameters from there.
What you'll have to do then is
delete your current network-parameters for every Node.
whitelist your Notary Node into your network-map-service
restart all your Nodes so they can retrieve the new network-parameters from the network-map-service where the new Notary is assigned as such
I don't know which network-map-service exactly you use but i assume its nms by cordite. You can read up on how to whitelist a Notary here: https://gitlab.com/cordite/network-map-service/-/blob/master/FAQ.md#14-start-the-notary-node
New to Corda and I am trying to run (debug) flow tests using the Corda Accounts in a Mock Network and get the following error :
java.lang.IllegalArgumentException: Corda service com.r3.corda.lib.accounts.workflows.services.KeyManagementBackedAccountService does not exist
when trying to create a anew account, or anything else for that matter. Is there something I am missing ? Any code would be appreciated.
That service is under com.r3.corda.lib.accounts.workflows.services package, meaning it's part of the accounts-workflows CorDapp; so you must include that CorDapp in your mocked network so it gets installed on your mocked nodes:
// Setup network.
network = new MockNetwork(new MockNetworkParameters().withCordappsForAllNodes(ImmutableList.of(
TestCordapp.findCordapp("com.r3.corda.lib.tokens.contracts"),
TestCordapp.findCordapp("com.r3.corda.lib.tokens.workflows"),
TestCordapp.findCordapp("com.r3.corda.lib.tokens.money"),
TestCordapp.findCordapp("com.r3.corda.lib.tokens.selection"),
TestCordapp.findCordapp("com.r3.corda.lib.accounts.contracts"),
// This CorDapp has the missing service from your error message.
TestCordapp.findCordapp("com.r3.corda.lib.accounts.workflows"),
TestCordapp.findCordapp("com.r3.corda.lib.ci")))
In general, if your node is supposed to run some code, you must install that code on that node; otherwise how it will be able to run it? So if you're using some library (e.g Accounts library, Tokens SDK); then you must install it on your node.
I am going through this documentation and I have several uncertainties.
Performing explicit contract and state upgrades
Preserve the existing state and contract definitions
Write the new state and contract definitions
Create the new CorDapp JAR
Distribute the new CorDapp JAR
Stop the nodes
Re-run the network bootstrapper (only if you want to whitelist the
new contract)
Restart the nodes
Authorise the upgrade
Perform the upgrade
Migrate the new upgraded state to the Signature Constraint from the
zone constraint
Questions:
1. Preserve the existing state and contract definitions
2. Write the new state and contract definitions
3. Create the new CorDapp JAR
How do I do that? is it meant only to preserve jars with contracts and states on nodes, not preserving them in source code? If I do not preserve them in source code then how can I create the upgrade method?
interface UpgradedContract<in OldState : ContractState, out NewState : ContractState> : Contract {
val legacyContract: ContractClassName
fun upgrade(state: OldState): NewState
}
If I do not preserve old state in source code, then shoud I name the jar differently each time I need to do an upgrade?
Can old jars be reoved from the node when the upgrade was completed?
6. Re-run the network bootstrapper (only if you want to whitelist the
new contract)
8. Authorise the upgrade
Am I right that only those 2 steps are related to Explicit contact upgrades? And If I use implicit flow with signature, then I need to skip only those two steps, while the others are still aplicable and must be performed?
9. Perform the upgrade
Should this be done for each state separately by the owner of the state? In that case should I run it on each node for specific contrcats where the node is the participant of the state? (In doc it is mentioned to be run on single node - but what id=f a single node is not participant of some state)
Other questions
This section describes explicit contracts and states update.
https://docs.corda.net/upgrading-cordapps.html#performing-explicit-contract-and-state-upgrades while signature constraint section (https://docs.corda.net/api-contract-constraints.html#signature-constraints) does not describe an update process for states.
is it the same as for explicit upgrades with the difference only in steps 6,8 or it is somewhat completely different?
Do I need to create the function transforming old states to new states in that case? if not , then how the old states will be handled by new flows?
I see you have many some great questions about contract upgrades. Here is an article that is written by one of our dev-relation engineers. https://medium.com/corda/contract-upgrades-and-constraints-in-corda-425055a9a47f
Feel free to follow up any additional questions that you have.
If you are new to Corda, feel free to join the Corda community channels #http://slack.corda.net/
While performing legacy contract upgrades, you need both the old and new contract jars installed on your node. (present in the cordapps folder).
You can create a new Gradle module say v2-contract and write the new contract in this. This is where you will write your UpgradedContract. You will need to refer to the old v1-conract jar as well as it needs to know what the old state was. To do this add a gradle dependency in v2-contract like below.
dependencies {
// Corda dependencies.
cordapp project(v1_contract)
}
The old jar can be removed from the cordapps folder, once all the states have been upgraded to new v2-contract.
a. For HashConstraints there is no need to run the bootstrapper again. You will write the new contract by implementing UpgradedContractWithLegacyConstraint,run the jar task to build this new jar, add it to the cordapps folder, run the Authorise Flow from all nodes, run the Initiate flow from one of he node's terminal. This is the explicit way of upgrading.
b. However if you are using Whitelistzoneconstraint, you want to make sure to add the new v2-contract jar's hash to whitelist param in network param. You will need to run the network Bootstrapper to whitelist this new v2-contracts jar hash. https://docs.corda.net/network-bootstrapper.html#whitelisting-contracts.
Once you do that you can either go for an explicit upgrade by implementing UpgradedContract, or you can use implicit upgrade.
c. If you are using Signature Constraints, no need to run the network Bootstrapper for the new jar, write the new v2-contract, build it using gradle jar task, replace old jar with new jar. This is the implicit way of upgrading.
You should run the Authorise Flow for all the participants only.
Other questions
There is no explicit upgrade in Signature constraints. You need to make sure you write your state in a backward compatible way, build new jar, replace old jar with new jar. The states will refer to the new contract then.
Hope that helps. Feel free to post more questions on the above answer or ping on Slack.
I have implemented the Hellow world example, https://docs.corda.net/hello-world-running.html, on two machines. Where I am running Notary and Party A on one machine and Party B on another machine.
After posting the transaction, I am able to check transaction through Shell by running vault query but I am not getting any H2 DB URL to connect and check the transaction in H2 DB. Please help me know , where I can find the H2 DB URL? I think user name should sa and password null. I have installed the latest H2 DB on my systems.
Please help
I tried with DBVisulaiser but no Corda tables are reflecting in schema
You can override the H2 database URL by specifying the URL as below in build.gradle in deployNodes task.
node {
name "O=Notary,L=Delhi,C=IN"
notary = [validating : false]
p2pPort 10004
......
extraConfig = ['h2Settings.address' : 'localhost:1000']
}
I was using corda opensource 3.2 in azure marketplace by following the instructions given in the
link : https://docs.corda.net/head/testnet-explorer-corda.html . And I am able to connect to the corda testnet via node explorer but I couldnt initiate a transaction because the issuer drop-down was not working. I have shared the screenshots below. And in transaction type only Pay option was there. What could be the issues?. can someone help me on this pls
It sounds like your node is not set up as an issuer of cash. Have you followed step 4 in the instructions?
Run the following to create a config file for the finance CorDapp:
echo "issuableCurrencies : [ USD ]" >
/opt/corda/cordapps/config/corda-finance--corda.conf