Corda attachment sample code java

(Sameer Hameed) #1


Im trying to upload attachment using using corda java template. But not able to till now. Below is my code

SecureHash ourAttachmentHash = null;

        try {
            InputStream inputStream = new FileInputStream(new File("G:\\"));
            String stringFile = new BufferedReader(new InputStreamReader(inputStream))
            ourAttachmentHash = SecureHash.sha256(stringFile);
        } catch (FileNotFoundException e) {
            //TODO add handling
        if (ourAttachmentHash != null) {

Below while imitating flow im getting :
net.corda.core.contracts.AttachmentResolutionException: Attachment resolution failure for CDD1EFE257DC4EA5F1DE5B67D745D2FB24351DD48444FA056A4741B7B74FD181

Do we have any sample\example written code in java? Please assist.

(Roger Willis) #2

Hi - do you might asking this on stackoverflow - we’ve moved all Corda technical support there. Tag your question with #corda.