About Contract Tutorial


(Erhan S) #1

Hi,
I am trying to read and understand contract tutorial (https://docs.corda.net/tutorial-contract.html) . I thought at the end of the page I will have a complete running example. However while reading the tutorial, it looks like examples down there are bits and pieces for different cases. Is intent here to provide individual examples for different cases or provide a complete example? Also is there a complete Java example in github showing some complex cases as described there?

Thanks…

PS: As I mentioned in other thread, here also, there are compile problems for Java code while using M14…


(Stefano Maffullo) #2

Try to follow the tutorial from M13 https://docs.corda.net/releases/release-M13.0/hello-world-contract.html , and as I suggested you in the other thread, you should really consider learning Kotlin, as far as I know it will be the main language for Corda.


(Roger Willis) #3

Hi there,

We are aware of this and will fix it when we have time. In the meantime, if you look at the hello world tutorial (that Stefano linked to above) it takes you through how to build a simple CorDapp (States, contracts, flows and interfaces).

Cheers!


(Erhan S) #4

Thanks, I’ve already exhausted them :slight_smile:


(Stefano Maffullo) #5

Aaaaah now I understand what you are saying, I tried to follow that tutorial too but at the end it wasn’t full functional. If I can suggest, @roger has a very well written enhanced IOU-cordapp in his repository, you should clone it and start working on it to learn some “advanced contract theory” , I think it’s public (and I used it as learning material too), hope @roger won’t be upset if I link it to you https://github.com/roger3cev/iou-cordapp-v2 :slight_smile:


(Roger Willis) #6

No worries!

We’ll build some more samples in the coming months - just a bit busy with other things at the moment. When V1 comes out, everything will be much easier too as there’ll be less need to constantly rebase!

Cheers


(Erhan S) #7

Hi Roger,
Sorry to bother you. I have a question. I run the nodes but at the very first step I got an error when I run command advised in the read me below.

flow start SelfIssueCashFlow amount: 10, currency: GBP

No matching constructor found:

  • [amount: Amount]: too many parameters

When I just enter:

flow start SelfIssueCashFlow amount: 10

i also get an error. It is not a big deal but just curiosity. While flow constructor is as follows:

SelfIssueCashFlow(val amount: Amount)

how do expect to map simple types to map Amount? Sorry I am not a Kotlin guy. I just read the Kotlin reference. Could not see an instruction for that? What is the right flow input arg to map Amount?
Thanks…


(Erhan S) #8

Hi Roger,
Sorry to bother you. I have a question. I run the nodes but at the very first step I got an error when I run command advised in the read me below.

flow start SelfIssueCashFlow amount: 10, currency: GBP

No matching constructor found:

  • [amount: Amount]: too many parameters

When I just enter:

flow start SelfIssueCashFlow amount: 10

I also get an error. It is not a big deal but just curiosity. While flow constructor is as follows:

SelfIssueCashFlow(val amount: Amount)

how do expect to map simple types to map Amount? Sorry I am not a Kotlin guy. I just read the Kotlin reference. Could not see an instruction for that? What is the right flow input arg to map Amount?
Thanks…


(Roger Willis) #9

No worries use: start SelfIssueCashFlow amount: £10

You are right… this is not obvious. Basically the shell can deserialise a range of objects automagically for you. I’ll make a note to improve the docs. Cheers