Corda: How to use attachments for reference of previous transaction? -




if transaction b valid when has reference previous transaction a, can include transaction a's state properties/contract code within attachment in transaction b? how attachment referenced , retrieved from? participating nodes of transaction b able view contents of transaction validation?

suppose have stateb, valid in presence of reference given transaction. define field in stateb of type signedtransaction hold reference.

in kotlin:

class stateb(val txref: signedtransaction?) : contractstate {     override val participants: list<abstractparty> get() = listof()     override val contract: templatecontract get() = templatecontract() } 

in java:

class stateb implements contractstate {     signedtransaction txref;      stateb(signedtransaction txref) {         this.txref = txref;     }      public signedtransaction gettxref() {         return txref;     }      @notnull     @override     public contract getcontract() {         return new templatecontract();     }      @notnull     @override     public list<abstractparty> getparticipants() {         return immutablelist.of();     } } 

the reference signedtransaction nullable. therefore imagine workflow create "invalid" stateb - 1 without reference transaction makes valid - , evolving stateb via transaction outputs stateb associated signedtransaction, making "valid" stateb.





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

python - Minimize function with Scipy minimize -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -