corda / net.corda.core.contracts / Attachment

Attachment

@DoNotImplement interface Attachment : NamedByHash

An attachment is a ZIP (or an optionally signed JAR) that contains one or more files. Attachments are meant to contain public static data which can be referenced from transactions and utilised from contracts. Good examples of how attachments are meant to be used include:

At the moment, non-ZIP attachments are not supported. Support may come in a future release. Using ZIP files for attachments makes it easy to ensure data on the ledger is compressed, which is useful considering that attachments may be widely replicated around the network. It also allows the jarsigner tool to be used to sign an attachment using ordinary certificates of the kind that many organisations already have, and improves the efficiency of attachment resolution in cases where the attachment is logically made up of many small files - e.g. is bytecode. Finally, using ZIPs ensures files have a timestamp associated with them, and enables informational attachments to be password protected (although in current releases password protected ZIPs are likely to fail to work).

Properties

signerKeys

abstract val signerKeys: List<PublicKey>

The keys that have correctly signed the whole attachment. Can be empty, for example non-contract attachments won't be necessarily be signed.

signers

abstract val signers: List<Party>

The parties that have correctly signed the whole attachment. Even though this returns a list of party objects, it is not required that these parties exist on the network, but rather they are a mapping from the signing key to the X.500 name.

size

abstract val size: Int

Attachment size in bytes.

Inherited Properties

id

abstract val id: SecureHash

Functions

extractFile

open fun extractFile(path: String, outputTo: OutputStream): <ERROR CLASS>

Finds the named file case insensitively and copies it to the output stream.

open

abstract fun open(): InputStream

openAsJAR

open fun openAsJAR(): JarInputStream

Extension Functions

contextLogger

fun Any.contextLogger(): <ERROR CLASS>

When called from a companion object, returns the logger for the enclosing class.

Inheritors

ContractAttachment

class ContractAttachment : Attachment

An Attachment which represents a contract JAR.