Reputation: 65
This is in continuation of my previous post. I have been able to call in-build endpoint for Corda attachment upload but I'm not sure how -
1) Where is this file uploaded (what if I want to store it at some specific location)?
and
2) How can I add this attachment to transaction so that it is available for other nodes?
I guess we need custom endpoint for these, so that I can upload the file to a given location and then pass the attachment(and it's hash code) in transactions.
Please assist.
Upvotes: 1
Views: 143
Reputation: 23140
1) Attachments are stored in the node's database, in the NODE_ATTACHMENTS table. You cannot specify a custom location.
2) You add an attachment to a transaction by hash:
@InitiatingFlow
@StartableByRPC
class AddAttachmentFlow(private val attachmentHashString: String) : FlowLogic<SignedTransaction>() {
@Suspendable
override fun call(): SignedTransaction {
val notary: Party = TODO("Pick a notary.")
val attachmentHash = SecureHash.parse(attachmentHashString)
val txBuilder = TransactionBuilder(notary)
txBuilder.addAttachment(attachmentHash)
TODO("Finish building transaction and gathering required signatures.")
}
}
Upvotes: 1