Giter Club home page Giter Club logo

samples-kotlin's Introduction

Corda

License

Corda

Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value.

Architecture Evolution

The code present in this repository reflects the first version of the implementation of the Corda model for DLT technology. This first architecture version covers Corda versions 1 through 4 and continues to deliver on the promise of DLT for both the open source community and industry as a whole.

However, like all things, Corda must evolve to serve the more stringent needs of today. This is why the second (and current) version of the Corda Architecture can be found here and will form the basis of the Corda 5 release.

Features

  • Smart contracts that can be written in Java and other JVM languages
  • Flow framework to manage communication and negotiation between participants
  • Peer-to-peer network of nodes
  • "Notary" infrastructure to validate uniqueness and sequencing of transactions without global broadcast
  • Enables the development and deployment of distributed apps called CorDapps
  • Written in Kotlin, targeting the JVM

Getting started

  1. Read the Getting Started documentation
  2. Run the Example CorDapp
  3. Read about Corda's Key Concepts
  4. Follow the Hello, World! tutorial

Useful links

Contributing

Corda is an open-source project and contributions are welcome!

To find out how to contribute, please see our contributing docs.

License

Apache 2.0

Acknowledgements

YourKit

YourKit supports open source projects with its full-featured Java Profiler.

YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.

samples-kotlin's People

Contributors

adelel1 avatar anixon604 avatar ashutoshmeher-r3 avatar benmcmahon100 avatar davidawad avatar diggluekeishikubo avatar divya-r3 avatar ja9-look avatar mcgovc avatar peterli-r3 avatar r3hj avatar waynelcw avatar wzur-r3 avatar xavierlepretre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samples-kotlin's Issues

runnodes jar throws "IOException: Cannot run program xterm"

Hi there,

I am trying to run the sample found at https://docs.corda.net/docs/corda-os/4.7/tutorial-cordapp.html

I have successfully cloned the repo and generated the nodes with ./gradlew deployNodes
When attempting to java -jar runnodes.jar I get the following output:

$ java -jar runnodes.jar 
base debug port set to: 5005
base monitoring port set to: 7005
Starting nodes in /somewhere/samples-kotlin/Basic/cordapp-example/build/nodes
No file corda.jar found in /somewhere/samples-kotlin/Basic/cordapp-example/build/nodes/.cache
Starting corda.jar in /somewhere/samples-kotlin/Basic/cordapp-example/build/nodes/PartyA on debug port 5005
Node will expose jolokia monitoring port on 7005
Running command: xterm -T PartyA -e '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java' '-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7005,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter' '-Dname=PartyA' '-jar' '/somewhere/samples-kotlin/Basic/cordapp-example/build/nodes/PartyA/corda.jar'; [ $? -eq 0 -o $? -eq 143 ] || sh
Exception in thread "main" java.io.IOException: Cannot run program "xterm" (in directory "/somewhere/Basic/cordapp-example/build/nodes/PartyA"): error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at net.corda.plugins.NodeRunner.startWindowed(NodeRunner.kt:133)
        at net.corda.plugins.NodeRunner.startJar(NodeRunner.kt:94)
        at net.corda.plugins.NodeRunner.startNode(NodeRunner.kt:73)
        at net.corda.plugins.NodeRunner.run(NodeRunner.kt:56)
        at net.corda.plugins.NodeRunnerKt.main(NodeRunner.kt:43)
Caused by: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
        at java.lang.ProcessImpl.start(ProcessImpl.java:134)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 5 more

Some other useful info:

 $ java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-8u282-b08-0ubuntu1~20.04-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
$ uname -a
Linux somebody 5.8.0-44-generic #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Heartbeat test fails when using shorter delay

Currently, the heartbeat occurs every second test waits for 6 seconds by sleeping the thread before observing the node's vault and the expected number of transactions is correct. 7 transactions - one for each second passed plus the initial one.

Successful CircleCI build

When I reduce the number of seconds to just 1 (8bf4101), I expected to have 2 transactions but instead, it's only the initial one.

Failed CircleCI build

A developer should be able to test any number of scheduled executions, including the minimal. Is this an issue with the testing approach or with Corda itself?

Basic examples don't build

The last merge commit that updates config of the (Merge pull request #18 from corda/NOTICK-update-artifactory-hostnames : 3d28bb2) breaks samples-kotlin/Basic apps (tried yo-cordapp and cordapp-example) compiles. As Following errors printed:

`A problem occurred configuring root project 'cordapp-example'.

Could not resolve all artifacts for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71.
Searched in the following locations:

  • file:/C:/Users/username/.m2/repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.71/kotlin-gradle-plugin-1.2.71.pom
  • file:/C:/Users/username/.m2/repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.71/kotlin-gradle-plugin-1.2.71.jar
    Required by:
    project :

Could not find net.corda.plugins:cordapp:5.0.12.
Searched in the following locations:

  • file:/C:/Users/username/.m2/repository/net/corda/plugins/cordapp/5.0.12/cordapp-5.0.12.pom
  • file:/C:/Users/username/.m2/repository/net/corda/plugins/cordapp/5.0.12/cordapp-5.0.12.jar
    Required by:
    project :

Could not find net.corda.plugins:cordformation:5.0.12.
Searched in the following locations:

  • file:/C:/Users/username/.m2/repository/net/corda/plugins/cordformation/5.0.12/cordformation-5.0.12.pom
  • file:/C:/Users/username/.m2/repository/net/corda/plugins/cordformation/5.0.12/cordformation-5.0.12.jar
    Required by:
    project :

Could not find net.corda.plugins:quasar-utils:5.0.12.
Searched in the following locations:

  • file:/C:/Users/username/.m2/repository/net/corda/plugins/quasar-utils/5.0.12/quasar-utils-5.0.12.pom
  • file:/C:/Users/username/.m2/repository/net/corda/plugins/quasar-utils/5.0.12/quasar-utils-5.0.12.jar
    Required by:
    project :

Possible solution:

The temporary solution that makes the projects compile: undoing the changes:

  1. Basic/constant.properties, update the first line to old version:
    cordaReleaseGroup=net.corda

  2. For cordapp-example, in gradle.build repositories undo comments:
    repositories {
    mavenCentral()
    jcenter()
    maven {
    url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases'
    }
    mavenLocal()
    }

Error while deploying nodes after configuring app in android studio

Hi, I am getting error while configuring sample source code application locally.
I am following the steps mentioned in official documentation link in given below.
Documentation Link: Run a sample CorDapp
I have upgraded the gradle to 7.3
and Kotlin version to 1.3 and after that when I run the command to deploy nodes as mentioned in documentation I am getting following error which is in "net.corda.plugins.cordformation" plugin.
Error is:

A problem was found with the configuration of task ':deployNodes' (type 'Cordform').

  • In plugin 'net.corda.plugins.cordformation' type 'net.corda.plugins.Cordform' property 'directory' has @input annotation used on property of type 'Path'.

    Reason: A property of type 'Path' annotated with @input cannot determine how to interpret the file.

    Possible solutions:

    1. Annotate with @InputFile for regular files.
    2. Annotate with @InputDirectory for directories.
    3. If you want to track the path, return File.absolutePath as a String and keep @input.

    Please refer to https://docs.gradle.org/7.3/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.

Please Help me to configure the following code. Thanks in advance.

how to build with cordapp project with corda enterprise?

hi, I try to run our cordapp with corda enterprise. we already get enterprise jars, and its placed at private github repo like https://raw.githubusercontent.com/our_organization/enterprise-maven-repo/master. with that setting, say, how to modify build.gradle at https://github.com/corda/samples-kotlin/blob/master/Basic/cordapp-example/build.gradle ?

we change https://github.com/corda/samples-kotlin/blob/master/Basic/cordapp-example/build.gradle#L23 to our private repository, with proper github user and token and authentication block like

        maven {
            url "https://raw.githubusercontent.com/tts-tblock/corda-44-ee/master"
            credentials {
                username "$gh_user"
                password "$gh_token"
            }
            authentication {
                basic(BasicAuthentication)
            }            
        }

then add corda dependency like below

    cordaCompile "$corda_release_group:corda-core:$corda_release_version"
    cordaRuntime "$corda_enterprise_release_group:corda-node-api:$corda_release_version"
    cordaRuntime "$corda_enterprise_release_group:corda:$corda_release_version"
    cordaCompile "$corda_enterprise_release_group:corda-jackson:$corda_release_version"
    cordaCompile "$corda_enterprise_release_group:corda-rpc:$corda_release_version"

where $corda_enterprise_release_group is 'com.r3.corda', and $corda_release_group is 'net.corda', and $corda_release_version is our corda enterprise version. we run ./gradlew build, confirmed jar files our repository is downloaded.

but when we try to dump our dependency with gradle task like following,

task dumpCompileFiles() {
     println project.configurations.compile*.toURI()
}

corda-4.4.jar still points net.corda, not com.r3.corda like /Users/me/.gradle/caches/modules-2/files-2.1/net.corda/corda/4.4/2e287dcc676f08818e151dd6d4116f06246eb51f/corda-4.4.jar I think with corda enterprise, this path should be like /Users/me/.gradle/caches/modules-2/files-2.1/com.r3.corda/corda/4.4/3ea036905388aee52ba2cf8f445ed5eefce1c31b/corda-4.4.jar.

its correct result for the cordapp project built with corda enterprise?

regards,

net.corda.client.rpc.RPCException: Cannot connect to server(s)

Hi
When you create nodes using Cordform, after building the project (through ./gradlew deployNodes) and running nodes (through ./build/nodes/runnodes) you can test APIs by running each server, e,g, runPartyAServer by command ./gradlew runPartyAServer.
But if you use Dockerform to create nodes, after building the project (through ./gradlew prepareDockerNodes) and running nodes (through docker-compose up), execution of command ./gradlew runPartyAServer encounters an error like the following:

I 21:36:25 1 RPCClient.logElapsedTime - Failed Startup took 259 msec
W 21:36:25 1 AnnotationConfigServletWebServerApplicationContext.refresh - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'controller' defined in file [.../clients/build/classes/java/main/net/corda/samples/example/webserver/Controller.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nodeRPCConnection': Invocation of init method failed; nested exception is net.corda.client.rpc.RPCException: Cannot connect to server(s). Tried with all available servers.

worldcupticketbooking DVPAccountsOnSameNode warning message

[WARN ] 2020-06-28T17:07:32,899Z [Node thread-1] statemachine.StaffedFlowHospital. - Flow [d030fed8-7aed-4572-898c-87113f904482] failed to be finalised. Manual intervention may be required before retrying the flow by re-starting the node. State machine state: StateMachineState(checkpoint=Checkpoint(invocationContext=InvocationContext(origin=Peer(party=O=Dealer1, L=London, C=GB), trace=Trace(invocationId=83020683-934e-4403-885e-05de6adee765, timestamp: 2020-06-28T17:07:32.206Z, entityType: Invocation, sessionId=83020683-934e-4403-885e-05de6adee765, timestamp: 2020-06-28T17:07:32.206Z, entityType: Session), actor=null, externalTrace=null, impersonatedActor=null), ourIdentity=O=Dealer1, L=London, C=GB, sessions={SessionId(toLong=8733183490391616331)=Initiated(peerParty=O=Dealer1, L=London, C=GB, peerFlowInfo=FlowInfo(flowVersion=1, appName=workflows-0.1), receivedMessages=[], initiatedState=Ended, errors=[], deduplicationSeed=D-5024188133067598548--1998938707450972611)}, subFlowStack=[Inlined(flowClass=class com.t20worldcup.flows.DVPAccountsOnSameNodeResponder, subFlowVersion=CorDappFlow(platformVersion=6, corDappName=workflows-0.1, corDappHash=EBB028258DB3856FE015675021F9EC1CF30167E1F2A92D0CE92A880C38FA0F57), isEnabledTimedFlow=false)], flowState=Started(flowIORequest=Receive(sessions=[FlowSessionImpl(destination=O=Dealer1, L=London, C=GB, sourceSessionId=SessionId(toLong=8733183490391616331))]), frozenFiber=F7B1B6763206ED07939E04A5381376A21F50AE8865E0B3ADAA1298A02AE96585), errorState=Clean, numberOfSuspends=5), flowLogic=com.t20worldcup.flows.DVPAccountsOnSameNodeResponder@74aa4f10, pendingDeduplicationHandlers=[MessageDeduplicationHandler(DeduplicationId(toString=N-R-5024188133067598548--1998938707450972611-11-2))], isFlowResumed=true, isWaitingForFuture=false, isAnyCheckpointPersisted=true, isStartIdempotent=false, isRemoved=false, senderUUID=b428c568-f686-452d-a5d0-98158c79d883) [errorCode=1ggjwsp, moreInformationAt=https://errors.corda.net/OS/4.4/1ggjwsp] {fiber-id=10000014, flow-id=d030fed8-7aed-4572-898c-87113f904482, invocation_id=83020683-934e-4403-885e-05de6adee765, invocation_timestamp=2020-06-28T17:07:32.206Z, origin=O=Dealer1, L=London, C=GB, session_id=83020683-934e-4403-885e-05de6adee765, session_timestamp=2020-06-28T17:07:32.206Z, thread-id=426, tx_id=91BDEE1F7207EDB50D7260CAA9370A98944156A1581D0C8C204E4A78D6EA35F4}
net.corda.core.flows.UnexpectedFlowEndException: Tried to access ended session SessionId(toLong=8733183490391616331) with empty buffer
at net.corda.node.services.statemachine.FlowStateMachineImpl.fillInLocalStackTrace(FlowStateMachineImpl.kt:176) ~[corda-node-4.4.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.processEventsUntilFlowIsResumed(FlowStateMachineImpl.kt:164) ~[corda-node-4.4.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.suspend(FlowStateMachineImpl.kt:449) ~[corda-node-4.4.jar:?]
at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:67) ~[corda-node-4.4.jar:?]
at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:71) ~[corda-node-4.4.jar:?]
at net.corda.core.flows.ReceiveTransactionFlow.call(ReceiveTransactionFlow.kt:103) ~[corda-core-4.4.jar:?]
at net.corda.core.flows.ReceiveTransactionFlow.call(ReceiveTransactionFlow.kt:31) ~[corda-core-4.4.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:331) ~[corda-node-4.4.jar:?]
at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:338) ~[corda-core-4.4.jar:?]
at net.corda.core.flows.ReceiveFinalityFlow.call(FinalityFlow.kt:277) ~[corda-core-4.4.jar:?]
at net.corda.core.flows.ReceiveFinalityFlow.call(FinalityFlow.kt:272) ~[corda-core-4.4.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:331) ~[corda-node-4.4.jar:?]
at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:338) ~[corda-core-4.4.jar:?]
at com.t20worldcup.flows.DVPAccountsOnSameNodeResponder.call(DVPAccountsOnSameNode.kt:134) ~[?:?]
at com.t20worldcup.flows.DVPAccountsOnSameNodeResponder.call(DVPAccountsOnSameNode.kt:124) ~[?:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:271) ~[corda-node-4.4.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.4.jar:?]
at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.12_r3-jdk8.jar:0.7.12_r3]
at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.12_r3-jdk8.jar:0.7.12_r3]
at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.12_r3-jdk8.jar:0.7.12_r3]
at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.12_r3-jdk8.jar:0.7.12_r3]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_251]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_251]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_251]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_251]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_251]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_251]
at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:63) ~[corda-node-4.4.jar:?]

Demonstrate How To Verify Signers With Accounts

The tictacthor sample has a commented out section where the signer verification should be
https://github.com/corda/samples-kotlin/blob/master/Accounts/tictacthor/contracts/src/main/kotlin/net/corda/samples/tictacthor/contracts/BoardContract.kt#L54-L56

            // Signatures
            // TODO: Should only the initiating party sign?
            //"Both participants must sign a SubmitTurn transaction." using (command.signers == outputBoardState.participants.map { it.owningKey })

You need to take into consideration that there could be multiple accounts on multiple nodes and any of the accounts could be transacting with each other so checking the host.owningKey isn't a valid check as that could allow an account to transact with itself.

The other issue is that the AccountSDK keys change all the time.
corda/accounts#50

Release a Tag

Hi, we are using your repo for sample contracts, we provide link to this repo because of that.
But we can't use word master in our project, can you release a tag with different name or probably some version, so that we can use it in the link?
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.