You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/platform/corda/4.13/community/get-started/tutorials/supplementary-tutorials/tutorial-attachments.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,37 @@ and which are shared explicitly. These are useful for attaching and signing audi
132
132
that isn’t used as part of the contract logic.
133
133
{{</note >}}
134
134
135
+
## How attachments are resolved
136
+
137
+
When building a transaction, Corda automatically tries to resolve any missing classor contract by finding a suitable attachment, using the following order of priority:
138
+
139
+
1. **InstalledCorDapps first:**Corda searches the locally installed CorDapps directories first for a matching attachment.
140
+
2. **Optional database fallback:**If no installed CorDappis found, and database fallback is enabled (by default, thisis enabled), then Corda will search the attachment store (trusted uploaders only). To enable or disable database fallback, use the `net.corda.node.transactionbuilder.missingClassDbSearchDisabled` option; see [Attachment resolution configuration properties]({{< relref "#attachment-resolution-configuration-properties">}}).
141
+
3. **LegacyCorDapps:**Legacy contracts are only resolved using the `legacy-contracts` CorDapps folder; Corda never falls back to the database.
142
+
4. **Compatibility filtering:**Attachments with an incompatible Kotlin version are excluded.
143
+
144
+
Prior to version 4.12, only the database option was used; this behavior can be restored using the `net.corda.node.transactionbuilder.installedFirstSearchDisabled` option; see [Attachment resolution configuration properties]({{< relref "#attachment-resolution-configuration-properties">}}).
145
+
146
+
### Deterministic attachment selection
147
+
148
+
If multiple attachments match, Corda uses deterministic ordering to ensure all nodes pick the same attachment.
149
+
Attachments are sorted by:
150
+
151
+
1. Version (descending)
152
+
2. Insertion date (descending) (for database attachments)
153
+
3. ID (ascending) (for installed attachments)
154
+
155
+
This prevents runtime-dependent selection and ensures identical transaction builds across the network.
| net.corda.node.transactionbuilder.missingClassDbSearchDisabled | false | Iftrue, disables database fallback — only installed CorDapps are searched. |
164
+
| net.corda.node.transactionbuilder.installedFirstSearchDisabled | false | Iftrue, restores the database-only lookup behavior used in versions prior to 4.12). |
165
+
135
166
## Example
136
167
137
168
Hereis a simple example of how to attach a file to a transaction and send it to the counterparty. The full code forthis demo can be found in the [Kotlin](https://github.com/corda/samples-kotlin/tree/release/4.13/Features/attachment-sendfile) and [Java](https://github.com/corda/samples-java/tree/release/4.13/Features/attachment-sendfile) sample repositories.
Copy file name to clipboardExpand all lines: content/en/platform/corda/4.13/enterprise/get-started/tutorials/supplementary-tutorials/tutorial-attachments.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,37 @@ and which are shared explicitly. These are useful for attaching and signing audi
132
132
that isn’t used as part of the contract logic.
133
133
{{</note >}}
134
134
135
+
## How attachments are resolved
136
+
137
+
When building a transaction, Corda automatically tries to resolve any missing classor contract by finding a suitable attachment, using the following order of priority:
138
+
139
+
1. **InstalledCorDapps first:**Corda searches the locally installed CorDapps directories first for a matching attachment.
140
+
2. **Optional database fallback:**If no installed CorDappis found, and database fallback is enabled, then Corda will search the attachment store (trusted uploaders only). To enable or disable database fallback, use the `net.corda.node.transactionbuilder.missingClassDbSearchDisabled` option; see [Attachment resolution configuration properties]({{< relref "#attachment-resolution-configuration-properties">}}).
141
+
3. **LegacyCorDapps:**Legacy contracts are only resolved using the `legacy-contracts` CorDapps folder; Corda never falls back to the database.
142
+
4. **Compatibility filtering:**Attachments with an incompatible Kotlin version are excluded.
143
+
144
+
Prior to version 4.12, only the database option was used; this behavior can be restored using the `net.corda.node.transactionbuilder.installedFirstSearchDisabled` option; see [Attachment resolution configuration properties]({{< relref "#attachment-resolution-configuration-properties">}}).
145
+
146
+
### Deterministic attachment selection
147
+
148
+
If multiple attachments match, Corda uses deterministic ordering to ensure all nodes pick the same attachment.
149
+
Attachments are sorted by:
150
+
151
+
1. Version (descending)
152
+
2. Insertion date (descending) (for database attachments)
153
+
3. ID (ascending) (for installed attachments)
154
+
155
+
This prevents runtime-dependent selection and ensures identical transaction builds across the network.
| net.corda.node.transactionbuilder.missingClassDbSearchDisabled | false | Iftrue, disables database fallback — only installed CorDapps are searched. |
164
+
| net.corda.node.transactionbuilder.installedFirstSearchDisabled | false | Iftrue, restores the database-only lookup behavior used in versions prior to 4.12). |
165
+
135
166
## Example
136
167
137
168
Hereis a simple example of how to attach a file to a transaction and send it to the counterparty. The full code forthis demo can be found in the [Kotlin](https://github.com/corda/samples-kotlin/tree/release/4.13/Features/attachment-sendfile) and [Java](https://github.com/corda/samples-java/tree/release/4.13/Features/attachment-sendfile) sample repositories.
0 commit comments